CharacterCasing CharacterCasing CharacterCasing CharacterCasing Enum

定义

指定 TextBox 控件中字符的大小写。Specifies the case of characters in a TextBox control.

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
继承
CharacterCasingCharacterCasingCharacterCasingCharacterCasing

字段

Lower Lower Lower Lower 2

将所有字符都转换为小写。Converts all characters to lowercase.

Normal Normal Normal Normal 0

字符大小写保持不变。The case of characters is left unchanged.

Upper Upper Upper Upper 1

将所有字符都转换为大写。Converts all characters to uppercase.

示例

下面的示例创建TextBox用于接受密码控件。The following example creates a TextBox control that is used to accept a password. 此示例使用CharacterCasing属性以将所有字符都更改为大写形式指定类型和MaxLength属性将密码长度限制为八个字符。This example uses the CharacterCasing property to change all characters typed to uppercase and the MaxLength property to restrict the password length to eight characters. 此示例还使用TextAligncenter 中的密码属性TextBox控件。This example also uses the TextAlign property to center the password in the TextBox control.

public:
   void CreateMyPasswordTextBox()
   {
      // Create an instance of the TextBox control.
      TextBox^ textBox1 = gcnew 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;
   }
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;
 }
 
Public Sub CreateMyPasswordTextBox()
    ' Create an instance of the TextBox control.
    Dim textBox1 As 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 = "*"c
    ' 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
End Sub

注解

使用此枚举的成员来设置的值CharacterCasing属性的TextBox控件。Use the members of this enumeration to set the value of the CharacterCasing property of the TextBox control.

适用于