找回密码
 加入
搜索
查看: 2039|回复: 2

[AU3基础] [已解决]请教:GUI控件取输入内容

[复制链接]
发表于 2010-4-20 09:34:14 | 显示全部楼层 |阅读模式
本帖最后由 acbs 于 2010-4-20 10:23 编辑

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("控件测试", 206, 129, 193, 115)
$Input1 = GUICtrlCreateInput("aaa", 32, 16, 153, 21)
$Input2 = GUICtrlCreateInput("bbb",32, 48, 153, 21)
$Button1 = GUICtrlCreateButton("Button1", 16, 88, 65, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 96, 88, 65, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

使用工具得到这些代码,我想点击Button1会执行一段代码,比如显示在input1中输入的内容应该怎么加代码呢?点击Button2会退出此对话框又该怎样去写呢?新手想学习一下这种格式的代码应该如何去写,请大家指点,谢谢.

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-4-20 10:05:11 | 显示全部楼层
回复 1# acbs
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("控件测试", 237, 85, 450, 341)
$Input1 = GUICtrlCreateInput("aaa", 14, 14, 121, 21)
$Input2 = GUICtrlCreateInput("bbb", 14, 44, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 150, 14, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 150, 44, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        MsgBox(0,"对话框","输入框1的内容是:"&GUICtrlRead($Input1))
                Case $Button2
                        Exit
        EndSwitch
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2010-4-20 10:14:51 | 显示全部楼层
感谢楼上,好好学习一下.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-3 09:13 , Processed in 0.078997 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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