創(chuàng)建按鈕(Button)控件.
GUICtrlCreateButton ( "文本", 左距, 頂距 [, 寬度 [,
高度 [, 樣式 [, 擴展樣式]]]] )
文本 | 按鈕控件顯示的文本. |
左距 | 控件左側(cè)的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算左側(cè)位置. |
頂距 | 控件上方的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算頂部位置. |
寬度 | [可選參數(shù)] 控件的寬度 (默認(rèn)文本自動調(diào)整適合寬度). |
高度 | [可選參數(shù)] 控件的高度 (默認(rèn)文本自動調(diào)整適合高度). |
樣式 | [可選參數(shù)] 控件的樣式. 查看附錄 GUI 控件樣式表. 默認(rèn) ( -1) : 無. 強制樣式 : $WS_TABSTOP |
擴展樣式 | [可選參數(shù)] 控件的擴展樣式. 查看附錄 擴展樣式表. |
成功: | 返回控件標(biāo)識符(控件ID). |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local
$Button_1,
$Button_2,
$msg
GUICreate("我的按鈕 GUI") ;
創(chuàng)建居中顯示的 GUI 窗口
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("運行記事本程序", 10,
30, 100)
$Button_2 = GUICtrlCreateButton("測試",
0, -1)
GUISetState() ; 顯示有兩個按鈕的對話框
; 運行 GUI, 直到
GUI 被關(guān)閉
While
1
$msg = GUIGetMsg()
Select
Case $msg
= $GUI_EVENT_CLOSE
ExitLoop
Case $msg
= $Button_1
Run('Notepad.exe') ; 將運行并打開記事本程序
Case $msg
= $Button_2
MsgBox(0,
'測試', '你點擊了 [ 測試 ] 按鈕') ; 將顯示 [ 測試 ] 按鈕被按下的通知消息
EndSelect
WEnd
EndFunc ;==>Example
provider with jb51.net (unicode) |