在自定义控件中,我只想继承WebControl中的Width和Height等属性而不想要WebControl中的Font等其他属性,该怎么办?我从WebControl继承控件,然后重写Font属性:
[Browsable(false)]
public override FontInfo Font
{
    get{return null;}
}虽然在属性浏览窗口看不到Font了,但是在后台代码仍然有Font属性,怎么彻底取掉(就好象Image服务器控件继承WebControl就没有了Font属性一样)

解决方案 »

  1.   

    把public改成private 或者 protected
      

  2.   

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
            public override FontInfo Font
            {
                get
                {
                    return base.Font;
                }
            }你把System.Web.dll程序集用Reflector反编译了看看Image服务器控件的源码就明白了