1

I want to add just the badge images in the right of the TreeNodes.

The expand/Collapse buttons, icons and texts shouldn't be changed.

I used the following code :

    public void treeView_DrawNode(object sender, DrawTreeNodeEventArgs e)
    {
        e.DrawDefault = true;

        e.Graphics.DrawImage(image1, e.Bounds.Right - 30, e.Bounds.Y);
    }

However, if the text of the treenode was long, it was over the image. The badge is invisible.

I think that e.DrawDefault = true; may affect after the function returns.

How can I show the badge images without redrawing the texts and icons?

Yun
  • 5,233
  • 4
  • 21
  • 38
  • Or is it possible to customdraw the texts in TreeNodes with the skin of system theme? – Yun Aug 30 '12 at 13:46
  • 1
    You can't draw outside of e.Bounds. And DrawDefault will draw over whatever you drew. And e.Bounds will be too small to fit both the image and the text. That's about enough bad news in one comment ;) – Hans Passant Aug 30 '12 at 14:00
  • Thanks for your comment. Here, the "Bounds" is no problem. I want to draw the small dot image in the right of the text. I'm finding the easy way. – Yun Aug 30 '12 at 14:04

0 Answers0