CharacterCasing 列挙型

定義

TextBox コントロール内の文字を大文字と小文字のどちらで表示するかを指定します。

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
継承
CharacterCasing

フィールド

Lower 2

すべての文字を小文字に変換します。

Normal 0

大文字と小文字はそのまま表示されます。

Upper 1

すべての文字を大文字に変換します。

次の例では、パスワードを TextBox 受け入れるために使用されるコントロールを作成します。 この例では、 プロパティを CharacterCasing 使用して、入力されたすべての文字を大文字に変更し、 プロパティを MaxLength 使用してパスワードの長さを 8 文字に制限します。 この例では、 プロパティを TextAlign 使用して、コントロール内のパスワードを中央に配置 TextBox します。

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 使用します。

適用対象