CharacterCasing Enum

Definisi

Menentukan kasus karakter dalam TextBox kontrol.

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
Warisan
CharacterCasing

Bidang

Lower 2

Mengonversi semua karakter menjadi huruf kecil.

Normal 0

Kasus karakter dibiarkan tidak berubah.

Upper 1

Mengonversi semua karakter menjadi huruf besar.

Contoh

Contoh berikut membuat TextBox kontrol yang digunakan untuk menerima kata sandi. Contoh ini menggunakan CharacterCasing properti untuk mengubah semua karakter yang di ketik menjadi huruf besar dan MaxLength properti untuk membatasi panjang kata sandi menjadi delapan karakter. Contoh ini juga menggunakan properti untuk mempusatkan TextAlign kata sandi dalam TextBox kontrol.

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

Keterangan

Gunakan anggota enumerasi ini untuk mengatur nilai CharacterCasing properti TextBox kontrol.

Berlaku untuk