Leaders snarfblam Posted September 29, 2004 Leaders Posted September 29, 2004 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? Quote [sIGPIC]e[/sIGPIC]
Leaders Iceplug Posted September 30, 2004 Leaders Posted September 30, 2004 Listboxes "hide" their background image property by Overriding it (possibly with a dummy property that cannot be set or get...ted). Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
*Gurus* divil Posted September 30, 2004 *Gurus* Posted September 30, 2004 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Leaders snarfblam Posted October 2, 2004 Author Leaders Posted October 2, 2004 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. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.