CharacterCasing 枚举

定义

指定 TextBox 控件中字符的大小写。

C#
public enum CharacterCasing
继承
CharacterCasing

字段

Lower 2

将所有字符都转换为小写。

Normal 0

字符大小写保持不变。

Upper 1

将所有字符都转换为大写。

示例

以下示例创建一个 TextBox 用于接受密码的控件。 此示例使用 CharacterCasing 该属性更改键入为大写的所有字符,并将 MaxLength 密码长度限制为 8 个字符。 此示例还使用 TextAlign 属性在控件中 TextBox 居中设置密码。

C#
public void CreateMyPasswordTextBox()
 {
    // Create an instance of the TextBox control.
    TextBox textBox1 = new TextBox();
    // Set the maximum length of text in the control to eight.
    textBox1.MaxLength = 8;
    // Assign the asterisk to be the password character.
    textBox1.PasswordChar = '*';
    // Change all text entered to be lowercase.
    textBox1.CharacterCasing = CharacterCasing.Lower;
    // Align the text in the center of the TextBox control.
    textBox1.TextAlign = HorizontalAlignment.Center;
 }

注解

使用此枚举的成员设置控件属性TextBox的值CharacterCasing

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7