本文整理匯總了C#中System.Windows.Forms.Control.Leave事件的典型用法代碼示例。如果您正苦於以下問題:C# Control.Leave事件的具體用法?C# Control.Leave怎麽用?C# Control.Leave使用的例子?那麽, 這裏精選的事件代碼示例或許可以為您提供幫助。
在下文中一共展示了Control.Leave事件的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: textBox1_Enter
private void textBox1_Enter(object sender, System.EventArgs e)
{
// If the TextBox contains text, change its foreground and background colors.
if (!string.IsNullOrEmpty(textBox1.Text))
{
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);
}
}
private void 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);
}