回复 6# chishingchan
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $title, $input1, $input2, $updown, $iUpDown = 0, $iCurrent = -400
$title = "My GUI UpDown"
GUICreate($title, -1, -1, -1, -1, $WS_SIZEBOX)
$input1 = GUICtrlCreateInput(StringFormat("%#.1f", $iCurrent), 10, 10, 100, 20); Current value
$input2 = GUICtrlCreateInput(0, 110, 10, 20, 20); UpDown offset value
$updown = GUICtrlCreateUpdown($input2)
GUISetState()
; Update the current value until the dialog is closed
Do
$iUpDown = Number(GUICtrlRead($input2))
If $iUpDown <> 0 Then
$iCurrent += ($iUpDown * 100)
IF $iCurrent >= 400 Then
$iCurrent=400
ElseIf $iCurrent <= -800 Then
$iCurrent=-800
EndIf
GUICtrlSetData($input1, StringFormat("%#.1f", $iCurrent))
GUICtrlSetData($input2, 0)
EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE
|