Hiding Base Members

snarfblam

Ultimate Contributor
Joined
Jun 10, 2003
Messages
2,097
Location
USA
I am creating a UserControl (which, of course, inherits the UserControl class). My class has three properties (of type Image). These images are set to the UserControl's BackgroundImage property to create a visual effect for normal, hover, and pressed states. The problem occurs when my control is instantiated on a form at design time. The problem is that along with my three image properties the public property BackgroundImage (from the base class UserControl) appears in the properties pane. It shows the image that is currently displayed on my control. It can also be manually set to a different image (that is, one that is not my normal, hover, or pressed image) altogether.

While this behavior is certainly not the end of the world, it is also certainly undesirable. So, finally, what I would like to know is if it is possible to HIDE this member from other accessing classes (NOT shadow it) so that it dissapears completely from my derived class's interface. And (of course) if it is possible, how do I accomplish it?
 
You cannot remove the property. You can hide it from the PropertyGrid by applying a Browsable(false) attribute to it in your derived class. You can hide it from the intellisense by apply an EditorBrowsable attribute to it in your derived class. You can stop its value being serialized by the designer by applying a DesignerSerializationVisibility attribute to it in your derived class.
 
Alright, thanks divil. I had noticed that some controls were missing properties found in their base class and was confuddled when there was no appearent way to do it.
 
Back
Top