mercredi 20 mars 2019

Adding Attribute To Base Class Properties

I have a form class (EasyForm) implemented System.Windows.Forms.Form. I am using EasyForm on stand-alone designer. I want to show only specific property of EasyForm on property grid. But property grid control is showing property from base class of Form (Component etc) although i am shadowing properties that i wan't show in property grid. For example; I shadowed "DoubleBuffered" property of System.Windows.Forms.Form class coming from its base class but "DoubleBuffered" property is appear in property grid.

PropertyGrid sample image

    [Browsable(false)]
    public new bool DoubleBuffered
    {
        get
        {
            return base.DoubleBuffered;
        }
        set
        {
            base.DoubleBuffered = value;
        }
    }

Are there any ways hidding DoubleBuffered property by reflection etc?





Aucun commentaire:

Enregistrer un commentaire