我通过注册windows消息GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY"),不能解决label控件的鼠标左键双击或右键单击功能,不知道是不支持还是没有找对方法?
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Label控件测试", 300, 152)
$Label1 = GUICtrlCreateLabel("标签1", 110, 25, 97, 33, $SS_CENTER)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
Switch GUIGetMsg()
Case $Label1
;MsgBox(0, "测试", "左键点击")
Case -3 ; $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
Local $Index, $itemText, $iMachineId, $answer
$IDFrom = DllStructGetData($tagNMHDR, 2)
$Event = DllStructGetData($tagNMHDR, 3)
$tagNMHDR = 0
If $IDFrom == $Label1 Then
If $Event = $NM_DBLCLK Then MsgBox(0, "测试", "双击了")
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
|