只是一个思路,鼠标移动提示可能会“频闪”,只要一个判断不在重写就没事了,自己去细化吧。
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 124, 193, 125)
$Button1 = GUICtrlCreateButton("按钮1", 16, 16, 161, 33, 0)
$Button2 = GUICtrlCreateButton("按钮2", 16, 72, 161, 33, 0)
$Edit1 = GUICtrlCreateEdit("", 200, 16, 145, 89)
GUICtrlSetData(-1, "捕获移动示例,"&@CRLF&"BY 顽固不化")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MOUSEMOVE
if $nMsg[3]>16 and $nMsg[3]<16+161 And $nMsg[4]>16 And $nMsg[4]<16+33 Then
GUICtrlSetData($Edit1,"鼠标在第一个按钮上")
ElseIf $nMsg[3]>16 and $nMsg[3]<16+161 And $nMsg[4]>72 And $nMsg[4]<72+33 Then
GUICtrlSetData($Edit1,"鼠标在第二个按钮上")
Else
GUICtrlSetData($Edit1,"捕获移动示例,"&@CRLF&"BY 顽固不化")
EndIf
Case $Button1
GUICtrlSetData($Edit1,"干'按钮1'的事去吧")
Case $Button2
GUICtrlSetData($Edit1,"干'按钮2'的事去吧")
EndSwitch
WEnd
|