saptechnique

Better late than never. - 郭富

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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);
        }

posted on 2009-11-20 10:30  guofu  阅读(286)  评论(0编辑  收藏  举报