private void userpwd_TextChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
password = userpwd.Text;
userpwd.PasswordChar = '\0';
}
else if (checkBox1.Checked == false)
{
password = userpwd.Text;
userpwd.PasswordChar = '*';
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
userpwd.PasswordChar = '\0';
}
else if (checkBox1.Checked == false)
{
userpwd.PasswordChar = '*';
}
}
文章描述了如何在C#中使用事件处理程序控制文本框(userpwd)的密码显示状态,当checkBox1选中时隐藏密码,未选中时显示星号。
2万+

被折叠的 条评论
为什么被折叠?



