实现效果:
知识运用:
TextBox控件的PasswordChar属性
实现代码:
private void btn_str_Click(object sender, EventArgs e) { textBox1.PasswordChar = (char)0; //取消屏蔽 } private void btn_password_Click(object sender, EventArgs e) { textBox1.PasswordChar='*'; //设置屏蔽字符 }