新手,关于GUI
本帖最后由 faceyao 于 2009-6-30 12:14 编辑请问想要按下按钮1则弹出“早上好”,按下按钮2则弹出“下午好”,请问代码该加到哪里?
把msgbox(0,"","早上好")和msgbox(0,"","下午好")加在哪个位置?#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 492, 291, 232, 168)
$Button1 = GUICtrlCreateButton("Button1", 176, 72, 107, 41, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button1", 178, 193, 107, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
EndSwitch
WEnd 如果格式没错就是
Case $Button1
msgbox(0,"","早上好")
Case $Button2
msgbox(0,"","下午好") 2# wuluck #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 492, 291, 232, 168)
$Button1 = GUICtrlCreateButton("Button1", 176, 72, 107, 41, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button1", 178, 193, 107, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Case $Button1
msgbox(0,"","早上好")
Case $Button2
msgbox(0,"","下午好")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
EndSwitch
WEnd
这样写了之后运行错误: #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 492, 291, 232, 168)
$Button1 = GUICtrlCreateButton("Button1", 176, 72, 107, 41, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button1", 178, 193, 107, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
msgbox(0, "", "早上好")
Case $Button2
msgbox(0, "", "下午好")
EndSwitch
WEnd 谢谢,已解决
页:
[1]