Hiding Inherited Control's Properties

Is this possible?

I'd like to inherit from a control so i can reuse some of it's base functionality, but override other parts. I tried using Shadows and creating a property over one that already existed, but the WindowsForms designer cried about the property not being there, so is there an attribute or something I can add to just make it not visible or something or am I barking up the wrong tree?

[403 byte] By [codefund.com] at [2008-2-21]
# 1
You can hide properties from the PropertyGrid with the Browsable(false) attribute.
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
yah, i know about that one, but I'm looking for a little more than that.
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 3
I'm afraid you won't find it. Removing members just isn't what inheritance is about.
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 4
Would you be able to just make a UserControl that has the control your inherited as a control that it contains with its dock property set to fill? That way you could expose only the properties you want.

Paul Tyng

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 5
Your solution lies (partially) into UITypeEditor.

A UITypeEditor will give you total control over the properties/events etc that the Control Properties Grid will display.

Check all the UITypeEditor member functions.

The reason i said partially is that these are only hidden from the Design Grid, but will not prevent you from using them in source code.

I.E: I can hide the "MyControl.Enabled" property from the property grid, but its always possible to do : "MyControl.Enabled = false;" using code.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 6
Just a quick fix to my previous reply:

Its actually the ControlDesigner class that has the properties/events hiding functions.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 7
Are you looking to hide these members at designtime or runtime? Why do you want to hide them?

thanks
- mike

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 8
originally, i wanted to inherit from the DataSet and put some stuff on top of it and hide some of the things that were already there, but I've changed my mind on this approach anyway, so actually I don't have an issue anymore...sorry for the weird question!
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...