Hi,
I've got a class which inherit from TreeNode. In this derived class, I provide a few properties to show in a propertygrid. But it also displays the properties of TreeNode. And I'd like to avoid that.
Is it possible And if so, how (any link to tutorial, documentation or help is welcomed ^^)

Hide the properties of a parent class ?
Ing. Miriam Escuadra
You used PostFilterAttributes instead of PostFilterProperties.
Tony
fanis
Brent K
GAJMAN
joe630330
I'll try to look in the msdn2 to check if the Keys of the properties are their name.
UncleHarpoon
First, create a class that inherits from ComponentDesigner and override the PostFilterProperties method:
Public Class MyTreeNodeDesigner
Inherits ComponentDesigner
Protected Overrides Sub PostFilterProperties(ByVal properties As IDictionary)
MyBase.PostFilterProperties(properties)
properties.Remove(" ") 'the name of the property you want to hide.
'you can add as many properties as you want.
End Sub
End Class
Then, add a Designer attribute to your TreeNode class.<Designer(GetType(MyTreeNodeDesigner))> _
Public
Class MyTreeNodeInherits TreeNode
...
End
ClassTony
Jasper Eenhoorn
I've tried to implement your solution, but I'm using managed C++, and am not sure if I did it correctly or not (it doesn't remove the BackColor property of treenode, given the following example)
public ref class CTest : public ComponentDesigner
{
public:
CTest(void) {};
protected:
virtual void PostFilterAttributes(IDictionary ^ attributes) override
{
ComponentDesigner::PostFilterAttributes(attributes);
attributes->Remove("BackColor");
}
};
[DesignerAttribute(CTest::typeid)]
public ref class CNode : public TreeNode
{
public:
CNode(void) {};
property float aFloatProperty;
}
MubasherAbad
First, quoted from the msdn :
"you must not remove items in the PostFilterProperties method" and
"You may also remove items in the PreFilterProperties method."
So I also overrided the PreFilterProperties method to remove the attributes.
But the problem comes from those lines :
[DesignerAttribute(CTest::typeid)]
public ref class INodeOptionsInterface : public System::Windows::Forms::TreeNode
{
...
};
It doesn't seem to work : when I create a brekpoint in the PreFilterProperties method of CTest, it's never reached.
And I must say that the new features of VS 2005, like [*Attribute(...)] are pretty obscure to me :/
Any idea why the [DesignerAttribute(CTest::typeid)] doesn't work
rdcharm
But unfortunately, it still doesn't work.
I really need helps on that. Can't anybody give me a hint A link to a good tutorial, or documentation
Thx in advance.
LaurentLDI
It's the only solution
miguelito928