Cube Tree Structure items: custom drawing
Posted by - NA - on 02 March 2009 10:14 AM
|
|
AbstractSometimes we need to display elements of the Cube Tree Structure in a different way: for example, mark out the used or recommended elements. ContentYou can override the drawing of the Tree Structure elements in the TOLAPGrid.OnDrawTreeNode event. The OnDrawTreeNode event argument’s properties: There are three ways of drawing a Tree 1. Default Drawing
2. Text Amended Drawing
3. Custom Drawing of the Text and Other Elements of the Node
By default the custom drawing text mode is set for the TOLAPGrid.CubeStructureTree object (TOLAPGrid.CubeStructureTree.DrawMode == TreeViewDrawMode.OwnerDrawText). You can change the drawing mode through the Tree’s property: TOLAPGrid.CubeStructureTree.DrawMode == TreeViewDrawMode.OwnerDrawText An example of the event handler: the already used dimensions will be displayed in bold red letters, and the already used hierarchies – in bold light-yellow letters. void Grid_OnDrawTreeNode(object Sender, TEventDrawTreeNodeArgs e)
{
e.DrawDefault = true;
if (e.IsUsing)
{
e.DrawDefault = false;
Brush brush = new SolidBrush(Color.Red);
if (e.Data is THierarchy)
brush = new SolidBrush(Color.Lime);
Font font = new Font(Grid.CubeStructureTree.Font, FontStyle.Bold);
e.Graphics.DrawString(e.Node.Text, font, brush, e.Bounds.Location);
}
}
In the derived objects of the TOLAPGrid, for the better control over the drawing process, you can reload the protected method: TOLAPGrid.DrawTreeNode(TEventDrawTreeNodeArgs e) | |
|