日期:2014-05-17 浏览次数:20970 次
public class MyComboBox : ComboBox
{
public MyComboBox()
{
this.GotFocus += MyComboBox_GotFocus;
this.LostFocus += MyComboBox_LostFocus;
}
void MyComboBox_LostFocus(object sender, EventArgs e)
{
Console.WriteLine("TabIndex不是我了,变成黄色");
base.ForeColor = System.Drawing.Color.Yellow;
}
void MyComboBox_GotFocus(object sender, EventArgs e)
{
Console.WriteLine("TabIndex是我了,变成蓝色");
base.ForeColor = System.Drawing.Color.Blue;
}
}