回复 3# pcbar
这个用定时器的方法可以看做“多线程”?
我用了下这个UDF,下面这个例子里,鼠标在靠近label下边界的时候,label会闪个不停,不知是何原因?
能否帮忙瞧一眼?
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include "GUICtrlSetOnHover_UDF.au3"
Opt("GUIOnEventMode", 1)
Local Const $iWidth = 230, $iHeight = 45
Local $hGUI
$hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0x19619C)
$BtnClose = GUICtrlCreateLabel("×", $iWidth - 16, 1, 12, 12)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xE8E8E8)
GUICtrlSetTip(-1, "Close")
GUICtrlSetOnEvent(-1, "_Exit")
GUICtrlSetOnHover(-1, "_Hover", "_Leave_Hover")
GUISetState()
While 1
Sleep(100)
WEnd
Func _Hover($ctrlId)
If $ctrlId = $BtnClose Then
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetPos($BtnClose, $iWidth - 16, 0)
EndIf
EndFunc
Func _Leave_Hover($ctrlId)
If $ctrlId = $BtnClose Then
GUICtrlSetColor(-1, 0xE8E8E8)
GUICtrlSetPos($BtnClose, $iWidth - 16, 1)
EndIf
EndFunc
Func _Exit()
Exit
EndFunc
|