閱讀英文

共用方式為


CharacterCasing 列舉

定義

指定 TextBox 控制項中字元的大小寫。

C#
public enum CharacterCasing
繼承
CharacterCasing

欄位

名稱 Description
Lower 2

將所有的字元轉換成小寫。

Normal 0

字元的大小寫不會變更。

Upper 1

將所有的字元轉換成大寫。

範例

下列範例會 TextBox 建立用來接受密碼的控制項。 這個範例會 CharacterCasing 使用 屬性來變更所有輸入為大寫的字元,以及 MaxLength 將密碼長度限制為八個字元的屬性。 此範例也會使用 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;
 }

備註

使用這個列舉的成員來設定 CharacterCasing 控制項的 TextBox 屬性值。

適用於

產品 版本
.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, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9