|
Customize appearance for every node
Monday, 04 January 2010
Generally, Flexible TreeView allows you to define the node control appearance for all nodes at one time. To be able to define different node control`s appearance for every node you need to override these node control methods:
To do that, you need to inherit your new node control class from the built-in one, override one of these methods and install this node control into a treeview as shown below: // The node control which displays a bold text when node is selected or focused. class MyNodeTextBox : NodeTextBox { public override Font GetFont(Node pNode, DrawContext pContext) { Font font = base.GetFont(pNode, pContext); if (pNode.IsSelected) { font = new Font(font, FontStyle.Bold); } return font; } } // use our new node control. MyNodeTextBox tb = new MyNodeTextBox(); tb.AttachTo(tree);
|
|