CharacterCasing Enumeração
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Especifica o caso dos caracteres num TextBox controlo.
public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing =
Public Enum CharacterCasing
- Herança
Campos
| Name | Valor | Description |
|---|---|---|
| Normal | 0 | O caso das personagens mantém-se inalterado. |
| Upper | 1 | Converte todos os caracteres para maiúsculas. |
| Lower | 2 | Converte todos os caracteres para minúsculas. |
Exemplos
O exemplo seguinte cria um TextBox controlo que é usado para aceitar uma palavra-passe. Este exemplo usa a CharacterCasing propriedade para alterar todos os caracteres digitados para maiúsculas e a MaxLength propriedade para restringir o comprimento da palavra-passe a oito caracteres. Este exemplo também usa a TextAlign propriedade para centralizar a palavra-passe no TextBox controlo.
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
Observações
Use os membros desta enumeração para definir o valor da CharacterCasing propriedade do TextBox controlo.