【已解决】求助:鼠标滑动事件导致密码输入框状态切换及倒计时按钮闪动问题,求解!
本帖最后由 lion.lee 于 2011-6-3 13:22 编辑问题1:显示密码后用鼠标滑过密码框,密码自动不显示。这是为什么呢?
问题2:倒计时框在倒计时的时候会闪几下(从6开始),怎么回事?#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
$Checkbox = GUICtrlRead($Checkbox1)
Select
Case $Checkbox = 4
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
Case $Checkbox = 1
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21)
EndSelect
Case $Button2
For $i = 20 To 1 Step -1
$Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
Sleep(500)
Next
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
EndSwitch
WEnd
本帖最后由 骗子 于 2011-6-3 12:07 编辑
倒计时的那个 换成; $Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
GUICtrlSetData ( $Button1,"运行倒计时" & $i )
按钮建立一次就行了,之后的全部用 GUICtrlSetData ( $Button1,"运行倒计时" & $i ) 更改显示的文本就行了
密码的那个好像也类似,只改样式就行了,不用重建
或者删了再重建 #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
Local $k=20
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("password", 88, 16, 137, 21, $ES_PASSWORD)
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
If GUICtrlRead($Checkbox1) = 4 Then
_GUICtrlEdit_SetPasswordChar($Input1, "*")
GUICtrlSetState($Input1, $GUI_FOCUS)
Else
_GUICtrlEdit_SetPasswordChar($Input1)
GUICtrlSetState($Input1, $GUI_FOCUS)
EndIf
Case $Button2
if GUICtrlRead($Button2)="确定" Then
AdlibRegister("time",1000)
GUICtrlSetData($Button2,"取消")
time()
Else
AdlibUnRegister("time")
GUICtrlSetData($Button1,"运行倒计时")
GUICtrlSetData($Button2,"确定")
$k=20
EndIf
EndSwitch
WEnd
func time()
if $k<1 Then
AdlibUnRegister("time")
Exit
EndIf
GUICtrlSetData($Button1,"运行倒计时"&$k)
$k-=1
EndFunc 感谢3mile兄得指点,问题已解决。谢谢啊! 回复 4# lion.lee
若已经解决请编辑标题为[已解决] 本帖最后由 lion.lee 于 2011-6-3 13:24 编辑
回复 2# 骗子
谢谢“骗子”兄弟,你的方法也可行。多谢啦!#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\test.kxf
$Form1_1 = GUICreate("Form1", 298, 100, 450, 339)
$Input1 = GUICtrlCreateInput("********", 88, 16, 137, 21)
$Checkbox1 = GUICtrlCreateCheckbox("显示密码", 8, 8, 73, 33)
$Button1 = GUICtrlCreateButton("运行倒计时", 8, 56, 217, 33)
$Button2 = GUICtrlCreateButton("确定", 240, 16, 49, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
$Checkbox = GUICtrlRead($Checkbox1)
Select
Case $Checkbox = 1
GUICtrlSetData($Input1, "password")
Case $Checkbox = 4
GUICtrlSetData($Input1, "********")
EndSelect
Case $Button2
$i = 20
$Button1 = GUICtrlCreateButton("运行倒计时" & $i, 8, 56, 217, 33)
For $i = 20 To 1 Step -1
GUICtrlSetData($Button1, "运行倒计时" & $i)
Sleep(500)
Next
GUICtrlSetData($Button1, "运行倒计时")
EndSwitch
WEnd
方法都不错~^%
页:
[1]