dws6225737 发表于 2008-9-29 13:04:31

新手提问--在GUI上创建一个选择框

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
    GUICreate("My GUI combo"); will create a dialog box that when displayed is centered

    GUICtrlCreateCombo("item1", 10, 10) ; create first item
    GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new default

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
      $msg = GUIGetMsg()
      
      If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example


就是让下拉列表的“item2”点击运行"d:\qq.exe",,,请问要怎样写。。。。。

[ 本帖最后由 dws6225737 于 2008-9-29 17:09 编辑 ]

liongodmien 发表于 2008-9-29 14:15:56


#include <GUIConstantsEx.au3>

Example()

Func Example()
       
    $Form = GUICreate("My GUI combo", 300, 100); will create a dialog box that when displayed is centered
       
    $Combo1 = GUICtrlCreateCombo("item1", 20, 20, 80, 20) ; create first item
    GUICtrlSetData($Combo1, "item2|item3", "item1") ; add other item snd set a new default
    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
      $msg = GUIGetMsg()
                Switch $msg      
                        Case $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $Combo1
                                If GUICtrlRead($Combo1) = "item1" Then
                                        MsgBox(64, "TEST", "测试,你选择了第一个项!", 3)
                                ElseIf GUICtrlRead($Combo1) = "item2" Then
                                        MsgBox(64, "TEST", "测试,你选择了第二个项!这里运行QQ", 3)
                                        Run("D:\QQ.exe")
                                Else
                                        MsgBox(64, "TEST", "测试,你选择了第三个项!", 3)
                                EndIf
                EndSwitch
    WEnd
EndFunc   ;==>Example

78391493 发表于 2008-9-29 14:21:09

被LS的抢了。。。。。

dws6225737 发表于 2008-9-29 17:10:13

谢谢二楼的兄弟!:face (33):

knelia 发表于 2014-6-10 11:16:06

好 用,多谢!
页: [1]
查看完整版本: 新手提问--在GUI上创建一个选择框