TextBox.UseSystemPasswordChar 属性


获取或设置一个值,该值指示 TextBox 控件中的文本是否作为默认密码字符显示。Gets or sets a value indicating whether the text in the TextBox control should appear as the default password character.

 property bool UseSystemPasswordChar { bool get(); void set(bool value); };
public bool UseSystemPasswordChar { get; set; }
member this.UseSystemPasswordChar : bool with get, set
Public Property UseSystemPasswordChar As Boolean



如果 TextBox 控件中的文本应该以默认的密码字符显示,则为 true;否则为 falsetrue if the text in the TextBox control should appear as the default password character; otherwise, false.


UseSystemPasswordChar属性优先于 PasswordChar 属性。The UseSystemPasswordChar property has precedence over the PasswordChar property. 每当 UseSystemPasswordChar 设置为时 true ,将使用默认的系统密码字符并忽略任何由设置的字符 PasswordCharWhenever the UseSystemPasswordChar is set to true, the default system password character is used and any character set by PasswordChar is ignored.


如果 TextBox 处于密码模式,因为 PasswordCharUseSystemPasswordCharReadOnly 为,则 true TextBox 处于受限模式。When the TextBox is in password mode because PasswordChar, UseSystemPasswordChar, or ReadOnly is true, the TextBox is in restricted mode. 在此模式下,将 ImeMode 禁用,但会缓存当前的, ImeMode 以便在永远不受限制的情况下还原 TextBoxIn this mode, the ImeMode is disabled, but the current ImeMode is cached so that it can be restored if the TextBox ever becomes unrestricted. 切换 ReadOnly 是常见方案。Toggling the ReadOnly is a common scenario. ImeMode当控件处于受限模式时,为隐藏。The ImeMode is shadowed while the control is in restricted mode. 从设计器的角度来看, ImeMode 显示的值是实际值。From the designer perspective, the ImeMode value shown is the actual value.