創(chuàng)建進(jìn)度條(Progress)控件.
GUICtrlCreateProgress ( 左距, 頂距 [, 寬度 [, 高度 [,
樣式 [, 擴(kuò)展樣式]]]] )
左距 | 控件左側(cè)的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算左側(cè)位置. |
頂距 | 控件上方的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計算頂部位置. |
寬度 | [可選參數(shù)] 控件的寬度(默認(rèn)使用先前的寬度). |
高度 | [可選參數(shù)] 控件的高度(默認(rèn)使用先前的高度). |
樣式 | [可選參數(shù)] 控件的樣式. 查看附錄 GUI 控件樣式表. |
擴(kuò)展樣式 | [可選參數(shù)] 控件的擴(kuò)展樣式. 查看附錄 擴(kuò)展樣式表. |
成功: | 返回控件標(biāo)識符(控件ID). |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
Example()
Func Example()
Local
$progressbar1,
$progressbar2,
$button,
$wait, $s, $msg, $m
GUICreate("我的進(jìn)度條 GUI", 220, 100, 100, 200)
$progressbar1 = GUICtrlCreateProgress(10,
10, 200, 20)
GUICtrlSetColor(-1, 32250); 不工作于
Windows XP 樣式
$progressbar2 = GUICtrlCreateProgress(10,
40, 200, 20, $PBS_SMOOTH)
$button = GUICtrlCreateButton("啟動",
75, 70, 70, 20)
GUISetState()
$wait
= 20; 進(jìn)度步進(jìn)值 20 毫秒
$s
= 0; 保存進(jìn)度值
Do
$msg = GUIGetMsg()
If $msg = $button Then
GUICtrlSetData($button, "停止")
For $i = $s To
100
If GUICtrlRead($progressbar1) = 50 Then MsgBox(0,
"信息", "完成一半...", 1)
$m =
GUIGetMsg()
If $m
= -3 Then ExitLoop
If $m
= $button
Then
GUICtrlSetData($button, "繼續(xù)")
$s = $i;保存當(dāng)前進(jìn)度位置到
$s
ExitLoop
Else
$s = 0
GUICtrlSetData($progressbar1, $i)
GUICtrlSetData($progressbar2, (100 -
$i))
Sleep($wait)
EndIf
Next
If $i > 100 Then
;
$s=0
GUICtrlSetData($button, "啟動")
EndIf
EndIf
Until
$msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example
provider with jb51.net (unicode) |