【已解决】鼠标移到控件上,改变它的颜色,应该用什么函数?
本帖最后由 229989799 于 2017-1-19 13:16 编辑鼠标移到控件上,改变它的颜色,应该用什么函数?
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 201, 192, 124)
$Label1 = GUICtrlCreateLabel("如何让鼠标移到此处,文本改变颜色呢", 40, 80, 280, 17)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Label1
Msgbox(0,"hello","hello")
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 201, 192, 124)
$Label1 = GUICtrlCreateLabel("如何让鼠标移到此处,文本改变颜色呢", 40, 80, 280, 17)
GUICtrlSetColor($Label1, 0x0000ff)
GUICtrlSetCursor(-1, 0)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
AdlibRegister('_set_lb_color', 600)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Label1
MsgBox(0, "hello", "hello")
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _set_lb_color()
Local $aCur = GUIGetCursorInfo($Form1)
If Not IsArray($aCur) Then Return
If $aCur == $Label1 Then
GUICtrlSetColor($Label1, 0xff0000)
Else
GUICtrlSetColor($Label1, 0x0000ff)
EndIf
EndFunc 谢谢楼上兄弟。 这个我也需要,标记一下
页:
[1]