public Form1()
{
InitializeComponent();
foreach ( Control vControl in Controls)
{
if (vControl is TextBox )
{
(( TextBox )vControl) . Enter += new EventHandler (TextBox_Enter);
(( TextBox )vControl) . Leave += new EventHandler (TextBox_Leave);
}
}
}
private void TextBox_Enter( object sender , EventArgs e)
{
(( TextBox )sender) . BackColor = Color . Red;
}
private void TextBox_Leave( object sender , EventArgs e)
{
(( TextBox )sender) . BackColor = SystemColors . Window;
}