gpt4 book ai didi

c# - 当光标在 winform 中的图标上时,如何使密码文本框值可见

转载 作者:太空宇宙 更新时间:2023-11-03 18:51:37 25 4
gpt4 key购买 nike

我正在使用 C# 创建一个 winforms 应用程序。现在我想在密码 textbox 旁边添加一个小眼睛 Icon 这样当用户将鼠标悬停在 Icon 上时,可以看到输入的内容迄今为止。因此,悬停时,文本框 应显示 123,当用户离开图标时,该框应再次显示为 ***。有什么方法可以用 C# 做到这一点吗?

最佳答案

textBox.UseSystemPasswordChar = true;
icon.MouseEnter += (sender, e) => textBox.UseSystemPasswordChar = false;
icon.MouseLeave += (sender, e) => textBox.UseSystemPasswordChar = true;

enter image description here

关于c# - 当光标在 winform 中的图标上时,如何使密码文本框值可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56922009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com