Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted

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?

[sIGPIC]e[/sIGPIC]
  • Leaders
Posted
Listboxes "hide" their background image property by Overriding it (possibly with a dummy property that cannot be set or get...ted).

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

  • *Gurus*
Posted
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.

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
Posted
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.
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...