Hi Gouri,
You'll have to override the DrawNode event of the TreeView
like this:
TreeView view;
private void setUpCustomDraw() {
// The TreeView will still take care of drawing the lines,
pluses,
minuses, etc...
view.DrawMode = TreeViewDrawMode.OwnerDrawText;
view.DrawNode += new
DrawTreeNodeEventHandler(view_DrawNode);
}
void view_DrawNode(object sender, DrawTreeNodeEventArgs e) {
Graphics g = e.Graphics;
TreeNode node = e.Node;
int arrowWidth = 10;
g.DrawString(node.Text, view.Font, Brushes.Black,
e.Bounds.X +
arrowWidth + 2, e.Bounds.Y);
if(e.State == TreeNodeStates.Selected) {
// Draw arrow
Point[] p = new Point[3];
p[0] = new Point(e.Bounds.Left, e.Bounds.Top + 2);
p[1] = new Point(e.Bounds.Left, e.Bounds.Bottom - 2);
p[2] = new Point(e.Bounds.Left + arrowWidth, (e.Bounds.Top
+
e.Bounds.Bottom) / 2);
g.FillPolygon(Brushes.Black, p);
}
}
I haven't tested it but the code should look a lot like
this
Cheers,
Bram Fokke
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharp googlegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribe googlegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---
|