Nyelv

TextBox.CharacterCasing Tulajdonság

Definíció

Lekérdezi vagy beállítja, hogy a TextBox vezérlőelem módosítja-e a karakterek esetét a beíráskor.

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

Tulajdonság értéke

Az egyik CharacterCasing számbavételi érték, amely meghatározza, hogy a TextBox vezérlőelem módosítja-e a karakterek esetét. Az alapértelmezett érték a CharacterCasing.Normal.

Kivételek

A tulajdonsághoz egy olyan érték lett hozzárendelve, amely nem esik az enumerálás érvényes értékeinek tartományán belül.

Példák

Az alábbi példakód egy TextBox jelszót elfogadó vezérlőt hoz létre. Ez a példa a tulajdonság használatával módosítja az CharacterCasing összes beírt karaktert kisbetűsre, a MaxLength tulajdonság pedig nyolc karakterre korlátozza a jelszó hosszát. Ez a példa a TextAlign tulajdonság használatával is középre helyezi a jelszót a TextBox vezérlőben.

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

Megjegyzések

A tulajdonság használatával CharacterCasing módosíthatja a karakterek esetét az alkalmazás által megkövetelt módon. Módosíthatja például a jelszóbejegyzéshez használt vezérlőelemben TextBox beírt összes karakter esetét nagybetűsre vagy kisbetűsre, hogy a jelszavakra vonatkozó szabályzatot kényszerítsen ki.

A következőre érvényes:

Lásd még