Flexible TreeView Flexible TreeView


Support & Community

NodeExpandablePanel node control

Previous Table of Contents Next

The NodeExpandablePanel node control is identical to the NodeExpandableTextBox node control, but shows any custom designed content instead of a text description.

NodeExpandablePanel node control


 

To use it, subscribe to the MeasureNodeControlCustomArea and PaintNodeControlCustomArea treeview events to measure and draw an expandable area respectively, as shows below.

Example:

// create the node control.
NodeExpandablePanel name = new NodeExpandablePanel();
name.AttachTo(tree);
 
// add a node with the title and custom drawing area.
NodeWithDescription node = new NodeWithDescription();
node.Text = "John Smith";
node.AttachTo(tree);
 
// prepare treeview to auto–expanding.
tree.Options.Node.AutoNodeHeight = true;
tree.Options.Selection.HoverStyle = eHoverStyle.SoftSelect;
 
// attach an event handlers to paint the expanded area.
tree.MeasureNodeControlCustomArea += tree_MeasureNodeControlCustomArea;
tree.PaintNodeControlCustomArea += tree_PaintNodeControlCustomArea;
 
// measure our node control`s size.
void tree_MeasureNodeControlCustomArea(FlexibleTreeView pTreeview, MeasureObjectEventArgs pArgs)
{
  pArgs.Size = new Size(20, 20);
}
 
// draw our node control.
private void tree_PaintNodeControlCustomArea(FlexibleTreeView pTreeview, NodeControlDrawEventArgs pArgs)
{
  Rectangle bounds;
 
  //draw the 20x20 red rectangle.
  bounds = pArgs.Context.Bounds;
  bounds.Size = new Size(20, 20);
  using (Brush br = new SolidBrush(Color.Red))
  {
    pArgs.Context.Graphics.FillRectangle(br, bounds);
  }
}

Previous Top Next

Last news
Bookmark and Share
Use Flexible TreeView in WPF project
Sunday, 18 December 2011

Do you have a WPF project and want to use Flexible TreeView there? No problem!

Flexible TreeView v3.4
Friday, 16 December 2011

Flexible TreeView v3.4 maintenance release has been released.

Flexible TreeView v3.3
Friday, 23 September 2011

Flexible TreeView v3.3 maintenance release has been released. Separate assemblies for .NET 2.0, 4.0 and 4.0 Client Profile, HTML markup extension, etc.

Latest release

Version:
Release date:
3.4
Dec 16, 2011


Copyright © 2006-2012 ARMSoft. All rights reserved.