找回密码
 加入
搜索
查看: 1273|回复: 4

新手,关于GUI

[复制链接]
发表于 2009-6-30 01:10:56 | 显示全部楼层 |阅读模式
本帖最后由 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
发表于 2009-6-30 02:06:07 | 显示全部楼层
如果格式没错就是
Case $Button1
msgbox(0,"","早上好")
Case $Button2
msgbox(0,"","下午好")
 楼主| 发表于 2009-6-30 11:54:30 | 显示全部楼层
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
这样写了之后运行错误:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-6-30 12:01:32 | 显示全部楼层
#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
 楼主| 发表于 2009-6-30 12:13:58 | 显示全部楼层
谢谢,已解决
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-13 05:22 , Processed in 0.081355 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表