C# 登录屏幕的隐藏密码 - 帮助和想法

Chr*_*ris 3 c# login

我想在文本框中隐藏密码。密码是硬编码的,我知道这不是很好,但它是项目所需的全部。

目前我正在使用点击事件,但是当使用选项卡时没有实现代码。

如何才能做到这一点?这是我当前的代码:

// Password Text Box Click Event

private void txtPassword_Click(object sender, EventArgs e)

{

// When password text box clixked, the watermark will disappear

txtPassword.Text = "";

txtPassword.ForeColor = Color.Black;

txtPassword.PasswordChar = '?'; // Password masking for added security

}
Run Code Online (Sandbox Code Playgroud)

B-R*_*Rad 5

只需使用文本框上的 UseSystemPasswordChar 属性。将其设置为真。要进行更多自定义,请将 PasswordChar 属性设置为类似 * 或其他一些普遍接受的密码字符。