哦,我只注意消息函数,没注意控件启用。点击控件后控件转换为灰色就不能操作了。只能再建一个控件
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $hGui = GUICreate("", 400, 400)
Global $Label = GUICtrlCreateLabel("Test Show", 50, 110, 100, 26)
Global $Labe2 = GUICtrlCreateLabel("Test Hide", 50, 110, 100, 26);"Test Hide/Show", 50, 110, 100, 26)
GUICtrlSetState($Labe2, 32)
GUISetState()
GUISetOnEvent(-3, "_Exit")
GUIRegisterMsg(0x0111, "WM_COMMAND")
;AdlibRegister("_Kh", 50)
While 1
Sleep(10)
WEnd
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $iIDFrom1
Switch BitAND(0xffff, $wParam)
Case $Label
GUICtrlSetState($Label, 32)
GUICtrlSetState($Labe2, 16)
GUICtrlSetFont($Labe2, 9, 400, 0, "宋体")
GUICtrlSetColor($Labe2, 0x0000FF) ;蓝色
Case $Labe2
GUICtrlSetState($Labe2, 32)
GUICtrlSetState($Label, 16)
GUICtrlSetFont($Label, 11, 400, 4, "宋体")
GUICtrlSetColor($Label, 0xFF0000) ;红色
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
|