다음을 통해 공유


TextBox.CharacterCasing 속성

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

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Property CharacterCasing As CharacterCasing
‘사용 방법
Dim instance As TextBox
Dim value As CharacterCasing

value = instance.CharacterCasing

instance.CharacterCasing = value
public CharacterCasing CharacterCasing { get; set; }
public:
property CharacterCasing CharacterCasing {
    CharacterCasing get ();
    void set (CharacterCasing value);
}
/** @property */
public CharacterCasing get_CharacterCasing ()

/** @property */
public void set_CharacterCasing (CharacterCasing value)
public function get CharacterCasing () : CharacterCasing

public function set CharacterCasing (value : CharacterCasing)

속성 값

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

예외

예외 형식 조건

InvalidEnumArgumentException

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

설명

CharacterCasing 속성을 사용하여 응용 프로그램에서 필요한 문자의 대/소문자를 변경할 수 있습니다. 예를 들어, TextBox 컨트롤에 입력한 모든 암호 문자의 대/소문자를 변경하여 암호 정책을 적용할 수 있습니다.

예제

다음 코드 예제에서는 암호를 입력하는 데 사용되는 TextBox 컨트롤을 만듭니다. 이 예제에서는 CharacterCasing 속성을 사용하여 입력된 모든 문자를 대문자로 변경하고 MaxLength 속성을 사용하여 암호 길이를 8자로 제한합니다. 또한 이 예제에서는 TextAlign 속성을 사용하여 암호를 TextBox 컨트롤의 가운데로 정렬합니다.

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
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:
   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.set_MaxLength(8);
    // Assign the asterisk to be the password character.
    textBox1.set_PasswordChar('*');
    // Change all text entered to be lowercase.
    textBox1.set_CharacterCasing(CharacterCasing.Lower);
    // Align the text in the center of the TextBox control.
    textBox1.set_TextAlign(HorizontalAlignment.Center);
} //CreateMyPasswordTextBox
public function CreateMyPasswordTextBox()
 {
    // Create an instance of the TextBox control.
    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;
 }
 

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

TextBox 클래스
TextBox 멤버
System.Windows.Forms 네임스페이스
CharacterCasing 열거형