using System.Reflection;//命名空间
public void HideFocusCues(Control control)//这里是关键,访问父类的私有成员
{
Type vType = typeof(Control);
FieldInfo vFieldInfo = vType.GetField("uiCuesState",
BindingFlags.Instance | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Static |
BindingFlags.FlattenHierarchy);
vFieldInfo.SetValue(control, 15);
}
void rbt_Paint(object sender, PaintEventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
HideFocusCues((Control)sender);
}