Inheritence question

  • Thread starter Thread starter Bob Shafer
  • Start date Start date
B

Bob Shafer

I am inheriting from a picturebox and would like to hide
some of the public properties and methods. Can this be
done. Thanks! Bob.
 
Instead of Inheritence, you can use contentment, aggregation COM based
inheritence trick..
u create all the same named properties in your class, and then create
picturebox internally..and expose its property via your class properties.

Regards,
NetPointer
 
You can't make properties go away in the descendant, but you can tell
the Property Grid not to show them. You can do this by overriding (or
redeclaring if it's not virtual) the property in your descendant, and
tagging it with the [Browsable(false)] attribute. This is what the .NET
framework does, for example, to make the BackgroundImage property
unavailable for the TextBox control -- the property exists, but the
Property Grid has been instructed not to show it.

There is no way to make a method go away in a descendant; for that, or
to make a property truly unavailable in your class (i.e., not accessible
even through code), you'll need to write a wrapper instead of a subclass.
 
Back
Top