英語で読む

次の方法で共有


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;
 }

注釈

コントロールの プロパティの値を設定するには、この列挙体の 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