feiye7366 发表于 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

水木子 发表于 2010-4-9 10:18:10

楼上代码不错,学习了!
不过需要指出一点 AdlibEnable 函数 在新版里已经替换为 AdlibRegister

tianya1631 发表于 2010-4-9 10:22:37

学习了,很经典的代码。。。。

南一 发表于 2010-4-9 10:36:54

楼上代码不错,学习了!
不过需要指出一点 AdlibEnable 函数 在新版里已经替换为 AdlibRegister
水木子 发表于 2010-4-9 10:18 http://www.autoitx.com/images/common/back.gif

是的,这个代码老版本写的,所以还是用AdlibEnable

lpxx 发表于 2010-4-9 12:50:18

有点像极域电子教室的黑屏效果。

menfan1 发表于 2010-4-9 13:03:01

怎么退出都没加个热键呢呵呵

feiye7366 发表于 2010-4-10 08:28:27

很好啊,有没有简单一点的

feiye7366 发表于 2010-4-10 08:44:51

运行程序时鼠标好象给锁定了

netegg 发表于 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

menfan1 发表于 2010-4-10 14:29:30

呵呵,学习一下。。

lxz 发表于 2010-4-10 16:56:00

学习一下。。
页: [1]
查看完整版本: 怎样让指定的字体不停变换颜色,请各大虾指教(解决问题)