Custom drawing on THTMLTreeView

I'm trying to draw a small image after the text on some nodes of a treeview.

If I use a standard TTreeview, I can use something like the following in OnCustomDrawItem:

procedure TForm1.tvwDataCustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;  var DefaultDraw: Boolean);
var NodeRect:TRect; Pic:TAdvGDIPPicture;
begin

   if Node.Level=1 then
   begin

     NodeRect:=Node.DisplayRect(TRUE);     //get the display position
     NodeRect.Offset(NodeRect.Width+10,0);   //move to end of text
     NodeRect.Width:=NodeRect.Height;           //make it square

     Pic:=TAdvGDIPPicture.Create;         
     Pic.Assign(GDIPPictureContainer1.FindPicture('test.png')    //small test picture
     Pic.Draw(Sender.Canvas,NodeRect);
     Pic.Free;

  end;
end;

and the image is drawn just after the node text .

However, when using a THTMLTtreeview, although the image is drawn, it seems to be immediately erased, I think when other nodes are drawn! Moving nodes, or in this example, clicking on some level 0 nodes does causes the image to reappear on the orignal node, so I know it is being drawn in the first place!

Can you suggest a way I can draw images on a THTMLTreeView.

Thanks.


In HTMLTreeView , our HTML rendering engine does all custom drawing for nodes in the treeview, so unfortunately, this replaces custom drawing. Have you tried inserting what you want to customize as HTML tags so the HTMLTreeView itself will take care of the rendering?

I did think of that, but as there is already various different HTML in the nodes it could get messy. I've actually decided to use your TAdvTreeView instead, and drawing the images on there is working well as I can line them up in a second column.