开发者

Get rid Of Many Events and Properties in user control windows appilication

开发者 https://www.devze.com 2023-02-18 04:36 出处:网络
Hi Experts I create an user co开发者_JS百科ntrol in windows application. when it inherits from Control base class it would have many events and properties that may be not uses in usercontrol and I wh

Hi Experts I create an user co开发者_JS百科ntrol in windows application.

when it inherits from Control base class it would have many events and properties that may be not uses in usercontrol and I what to hide then in Properties Window.

How I can do this? thanks


use the following 3 attributes on the events or properties: when you cannot override the property, just replace 'override' with 'new'. The EditorBrowsable attribute has no effect on the properties window, but on the code editor.

    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public override Color BackColor
    {
        get 
        {
            //implementattion
        }
        set 
        {
            //implementation
        }
    }


If i have understood properly, then you should change the accessor level base control methods and events to private which you want to hide from child class.

0

精彩评论

暂无评论...
验证码 换一张
取 消