Condividi tramite


CharacterCasing Enumerazione

Definizione

Specifica il case dei caratteri in un controllo TextBox.

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
Ereditarietà
CharacterCasing

Campi

Nome Valore Descrizione
Normal 0

Il case dei caratteri rimane invariato.

Upper 1

Converte tutti i caratteri in maiuscolo.

Lower 2

Converte tutti i caratteri in lettere minuscole.

Esempio

Nell'esempio seguente viene creato un TextBox controllo utilizzato per accettare una password. In questo esempio viene utilizzata la CharacterCasing proprietà per modificare tutti i caratteri digitati in maiuscolo e la MaxLength proprietà per limitare la lunghezza della password a otto caratteri. In questo esempio viene usata anche la TextAlign proprietà per centrare la password nel TextBox controllo .

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

Commenti

Utilizzare i membri di questa enumerazione per impostare il valore della CharacterCasing proprietà del TextBox controllo .

Si applica a