1usingSystem;2usingSystem.Data;3usingSystem.Drawing;4usingSystem.Text;5usingSystem.Windows.Forms;6namespaceTest057{8publicpartialclassForm1 : Form9{10publicForm1()11{12InitializeComponent();13}14PRivatevoidForm1_Load(objectsender, EventArgs e)15{16textBox1.PassWordChar ='*';17textBox2.UseSystemPasswordChar =true;18}19}20}
[flash=500,400]http://s1.knowsky.com/20160211/t40kw3gdc0e00.png[/flash]
textBox1.PasswordChar = '*',在窗体设置中选择的是“#”,而且不报错,需要我们以代码为主,代码中设置的显示符会最终决定显示效果,而且,优先级
UseSystemPasswordChar > PasswordChar > 控件属性设置