关于输入框与文字标签同步
本帖最后由 xlcwxl 于 2009-10-22 14:26 编辑输入框与文字标签同步太频繁,出现闪烁#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("窗体1", 413, 305, 302, 218)
$Input1 = GUICtrlCreateInput("Input1", 120, 24, 121, 21)
$Group1 = GUICtrlCreateGroup("Group1", 144, 112, 185, 105)
$Input2 = GUICtrlCreateInput("Input2", 184, 152, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Label1", 176, 128, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
GUICtrlSetData($Label1,GUICtrlRead($Input1))
GUICtrlSetData($Input2,GUICtrlRead($Input1))
WEnd答案见2楼,
注意,新版的为AdlibEnable改为AdlibRegister
AdlibRegister ( "函数" [, 时间] )
函数 要注册的 Adlib 函数名称.
时间 [可选参数] 多长时间调用一次函数(单位为毫秒). 默认(Default)为 250 毫秒.
每当 250 毫秒 (或者 时间 毫秒) 就调用指定的"函数"--通常用于检查不可预知的错误 #include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("窗体1", 413, 305, 302, 218)
$Input1 = GUICtrlCreateInput("Input1", 120, 24, 121, 21)
$Group1 = GUICtrlCreateGroup("Group1", 144, 112, 185, 105)
$Input2 = GUICtrlCreateInput("Input2", 184, 152, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Label1", 176, 128, 36, 17)
GUISetState(@SW_SHOW)
AdlibEnable("tb",50)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
func tb()
GUICtrlSetData($Label1,GUICtrlRead($Input1))
GUICtrlSetData($Input2,GUICtrlRead($Input1))
EndFunc
使用事件模式更好些........ 哈哈,这个刚好学习。。 这个也刚好用到,学习了。。
页:
[1]