找回密码
 加入
搜索
查看: 4196|回复: 11

[AU3基础] 怎样让指定的字体不停变换颜色,请各大虾指教(解决问题)

  [复制链接]
发表于 2010-4-9 08:39:40 | 显示全部楼层 |阅读模式
本帖最后由 feiye7366 于 2011-3-23 21:17 编辑

怎样让指定的字体不停变换颜色,请各大虾指教
发表于 2010-4-9 10:05:00 | 显示全部楼层
本帖最后由 南一 于 2010-4-10 23:21 编辑

给你一份黑屏肃静的代码,字体不停的变色的。
现在不锁鼠标和键盘了,ESC退出
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "quit")

Opt("GUICloseOnESC", 0)


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("System Net server", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_CHILD, $WS_POPUP), $WS_EX_TOPMOST)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("黑屏肃静", @DesktopWidth / 2 - 110, @DesktopHeight / 2 - 20, 500, 500)
GUICtrlSetColor($Label1, 0xf7f957)
GUICtrlSetFont($Label1, "50", "200")
GUICtrlSetBkColor($Label1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibEnable("color", 500)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func color()
        $random = Random(1, 10, 1)
        Select
                Case $random = 1
                        GUICtrlSetColor($Label1, 0xf91f19)
                Case $random = 2
                        GUICtrlSetColor($Label1, 0x4bf907)
                Case $random = 3
                        GUICtrlSetColor($Label1, 0x07cef9)
                Case $random = 4
                        GUICtrlSetColor($Label1, 0x0d07f9)
                Case $random = 5
                        GUICtrlSetColor($Label1, 0xf907e5)
                Case $random = 6
                        GUICtrlSetColor($Label1, 0xfc7d0c)
                Case $random = 7
                        GUICtrlSetColor($Label1, 0xaefe02)
                Case $random = 8
                        GUICtrlSetColor($Label1, 0xfe0296)
                Case $random = 9
                        GUICtrlSetColor($Label1, 0xb402fe)
                Case $random = 10
                        GUICtrlSetColor($Label1, 0x02fbfe)
        EndSelect

EndFunc   ;==>color

Func quit()
        Exit
EndFunc   ;==>quit

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 2金钱 +40 收起 理由
afan + 20
水木子 + 20 学习了

查看全部评分

发表于 2010-4-9 10:18:10 | 显示全部楼层
楼上代码不错,学习了!
不过需要指出一点 AdlibEnable 函数 在新版里已经替换为 AdlibRegister
发表于 2010-4-9 10:22:37 | 显示全部楼层
学习了,很经典的代码。。。。
发表于 2010-4-9 10:36:54 | 显示全部楼层
楼上代码不错,学习了!
不过需要指出一点 AdlibEnable 函数 在新版里已经替换为 AdlibRegister
水木子 发表于 2010-4-9 10:18


是的,这个代码老版本写的,所以还是用AdlibEnable
发表于 2010-4-9 12:50:18 | 显示全部楼层
有点像极域电子教室的黑屏效果。
发表于 2010-4-9 13:03:01 | 显示全部楼层
怎么退出都没加个热键呢呵呵
 楼主| 发表于 2010-4-10 08:28:27 | 显示全部楼层
很好啊,有没有简单一点的
 楼主| 发表于 2010-4-10 08:44:51 | 显示全部楼层
运行程序时鼠标好象给锁定了
发表于 2010-4-10 09:04:04 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 443, 192, 124)
$Label1 = GUICtrlCreateLabel("", 216, 80, 280, 132)
GUICtrlSetFont(-1, 36, 800, 0, "微软雅黑")
GUICtrlSetData(-1, "0xFF0000")
GUICtrlSetColor(-1, 0xFF0000)
AdlibRegister("color", 1000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func color()
        $color = "0x" & (Hex(Random(0, 256),2)) & String(Hex(Random(0, 256), 2)) & String(Hex(Random(0, 256),2))
    GUICtrlSetData($Label1, $color)
    GUICtrlSetColor($Label1, $color)
EndFunc

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-4-10 14:29:30 | 显示全部楼层
呵呵,学习一下。。
发表于 2010-4-10 16:56:00 | 显示全部楼层
学习一下。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-21 05:10 , Processed in 0.083320 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表