回复 1# 魔导
好像没有吧,还得判断.
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
$Form1 = GUICreate("只能输入1-50", 341, 208, 192, 124)
$Input1 = GUICtrlCreateInput("", 72, 40, 153, 20, $ES_NUMBER)
GUICtrlSetLimit(-1, 2)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
$read = GUICtrlRead($Input1)
If Not StringRegExp($read, '^[1-5]?(?:(?<=[0-4])\d|(?<=5)0)?$', 0) Then
GUICtrlSetData($Input1, StringTrimRight($read, 1))
EndIf
WEnd
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
$Form1 = GUICreate("只能输入1-50", 341, 208, 192, 124)
$Input1 = GUICtrlCreateInput("", 72, 40, 153, 20, $ES_NUMBER)
GUICtrlSetLimit(-1, 2)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
$read = GUICtrlRead($Input1)
Switch $read
Case 1 To 50
Case Else
GUICtrlSetData($Input1, StringTrimRight($read, 1))
EndSwitch
WEnd
|