1 using System; 2 using System.Data; 3 using System.Drawing; 4 using System.Text; 5 using System.Windows.Forms; 6 namespace Test05 7 { 8 public partial class Form1 : Form 9 {10 public Form1()11 {12 InitializeComponent();13 }14 PRivate void Form1_Load(object sender, EventArgs e)15 {16 textBox1.PassWordChar = '*';17 textBox2.UseSystemPasswordChar = true;18 }19 }20 }
textBox1.PasswordChar = '*',在窗體設置中選擇的是“#”,而且不報錯,需要我們以代碼為主,代碼中設置的顯示符會最終決定顯示效果,而且,優(yōu)先級
UseSystemPasswordChar > PasswordChar > 控件屬性設置
新聞熱點
疑難解答