|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Método Control.OnEnter
Assembly: System.Windows.Forms (em System.Windows.Forms.dll)
privatevoid textBox1_Enter(object sender, System.EventArgs e) { // If the TextBox contains text, change its foreground and background colors.if (textBox1.Text != String.Empty) { textBox1.ForeColor = Color.Red; textBox1.BackColor = Color.Black; // Move the selection pointer to the end of the text of the control. textBox1.Select(textBox1.Text.Length, 0); } } privatevoid textBox1_Leave(object sender, System.EventArgs e) { // Reset the colors and selection of the TextBox after focus is lost. textBox1.ForeColor = Color.Black; textBox1.BackColor = Color.White; textBox1.Select(0,0); }
private void textBox1_Enter(Object sender, System.EventArgs e)
{
// If the TextBox contains text, change its foreground and background
// colors.
if (!(textBox1.get_Text().Equals(""))) {
textBox1.set_ForeColor(Color.get_Red());
textBox1.set_BackColor(Color.get_Black());
// Move the selection pointer to the end of the text of the
// control.
textBox1.Select(textBox1.get_Text().get_Length(), 0);
}
} //textBox1_Enter
private void textBox1_Leave(Object sender, System.EventArgs e)
{
// Reset the colors and selection of the TextBox after focus is lost.
textBox1.set_ForeColor(Color.get_Black());
textBox1.set_BackColor(Color.get_White());
textBox1.Select(0, 0);
} //textBox1_Leave
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.