关于重置控件样式
登录界面input控件,想利用一个checkbox控制密码可见\或$ES_password样式,尝试了GUICtrlSetStyle,没有什么效果,请问大佬们有什么好的建议吗$Form1 = GUICreate("集中制票平台", 300, 200, -1, -1)$usrnLabel0 = GUICtrlCreateLabel("用户名",72, 8, 36, 25)
$Input1 = GUICtrlCreateInput("", 72, 32, 145, 21)
GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, "请输入")
GUICtrlSetState($Input1, $GUI_FOCUS)
$pswLabel0 = GUICtrlCreateLabel("密码", 72, 64, 36, 25)
$Input2 = GUICtrlCreateInput("", 72, 88, 145, 21,$ES_PASSWORD)
GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, "请输入")
$Checkbox1 = GUICtrlCreateCheckbox("显示", 224, 88, 49, 17)
GUICtrlSetOnEvent(-1,"Pswdsp")
$ReButton0 = GUICtrlCreateButton("注册", 32, 136, 73, 33)
GUICtrlSetOnEvent(-1,"Register")
$LgButton0 = GUICtrlCreateButton("登录", 200, 136, 73, 33)
GUICtrlSetOnEvent(-1,"Login")
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
Func Pswdsp()
If BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED)Then
GUICtrlSetStyle($Input2,"")
Else
GUICtrlSetStyle($Input2,0x0020)
EndIf
EndFunc
不能测试。代码没完整 本帖最后由 yuantian 于 2020-6-26 22:00 编辑
给你看一下论坛的已有的解决方案:
https://www.autoitx.com/forum.ph ... 22&page=1#pid734623
部分代码:
#include <GuiEdit.au3>
Func Pswdsp()
If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKEDThen
_GUICtrlEdit_SetPasswordChar($Input2)
GUICtrlSetState($Input2,$GUI_FOCUS)
Else
_GUICtrlEdit_SetPasswordChar($Input2,"*")
GUICtrlSetState($Input2,$GUI_FOCUS)
EndIf
EndFunc
yuantian 发表于 2020-6-26 21:59
给你看一下论坛的已有的解决方案:
https://www.autoitx.com/forum.ph ... 22&page=1#pid734623
十分感谢,之前看过这篇文章没有仔细阅读,再看了看代码非常适用,谢谢
页:
[1]