怎么创建一个带“取消”或关闭的进度条!
最近在做一个带判断的进度条,一旦判断不到连接,就变成死循环了,请教一下怎么创建一个带“取消”或关闭的进度条![ 本帖最后由 joyand2002 于 2008-11-15 20:16 编辑 ] 代码没有怎么帮你? ;用事件驱动模式
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
GuiCreate("MyGUI", 372, 88,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Progress_1 = GuiCtrlCreateProgress(10, 10, 370, 20)
$Button_2 = GuiCtrlCreateButton("start", 10, 40, 60, 30)
$Button_3 = GuiCtrlCreateButton("pause", 80, 40, 60, 30)
$Button_4 = GuiCtrlCreateButton("exit", 150, 40, 70, 30)
Opt("GUIOnEventMode", 1)
Dim $start =0 ,$ostart
GuiSetState()
GUISetOnEvent($GUI_EVENT_CLOSE,"gui")
GUICtrlSetOnEvent($Button_2,"gui")
GUICtrlSetOnEvent($Button_3,"gui")
GUICtrlSetOnEvent($Button_4,"gui")
While 1
If $start >=0 Then
Sleep(50)
$start +=1
If $start >100 Then $start=0
If $start >=0 Then
$ostart = $start
GUICtrlSetData($Progress_1,$start)
Else
ContinueLoop
EndIf
EndIf
WEnd
Exit
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE,$Button_4
Exit
Case $Button_2
$start=0
Case $Button_3
If $start=-100 Then
$start =$ostart
Else
$start=-100
EndIf
EndSwitch
EndFunc 非常好的例子,感谢了!
:face (1):
页:
[1]