TextBox.CharacterCasing 속성

정의

문자를 입력할 때 TextBox 컨트롤에서 해당 문자의 대/소문자를 수정하는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::CharacterCasing CharacterCasing { System::Windows::Forms::CharacterCasing get(); void set(System::Windows::Forms::CharacterCasing value); };
public System.Windows.Forms.CharacterCasing CharacterCasing { get; set; }
member this.CharacterCasing : System.Windows.Forms.CharacterCasing with get, set
Public Property CharacterCasing As CharacterCasing

속성 값

CharacterCasing

CharacterCasing컨트롤에서 문자의 대/소문자를 수정할지 여부를 지정하는 TextBox 열거형 값 중 하나입니다. 기본값은 CharacterCasing.Normal입니다.

예외

열거형의 올바른 값 범위에 속하지 않는 값이 속성에 할당된 경우

예제

다음 코드 예제에서는 암호를 허용하는 데 사용되는 컨트롤을 만듭니다 TextBox . 이 예제에서는 속성을 사용하여 입력된 모든 문자를 소문자로 변경하고MaxLength, 이 속성을 사용하여 CharacterCasing 암호 길이를 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 입력된 모든 문자의 대/소문자를 대문자 또는 소문자로 변경하여 암호에 대한 정책을 적용할 수 있습니다.

적용 대상

추가 정보