If on the mouse up event I use
Tree1.Canvas.Draw(X,Y,Bitmap)
this works fine until I do anything else, such as turn on or off the grid, go to add a TreeNodeShape, etc. then the image disappears. How can I save the canvas?
Draw on Canvas
Hi Tom
Thanks for the reply
I am using the TTree components for users to map out farms and overlay building, pens and other features, using TTreeNodeShapes. This is all working very well. The background is an overhead image of the farm from Google Earth that is used as a template. Some features on the farm I do not need to save as a TreeNodeShape as they have no attached objects.Streams and paths are an example. In this case I am allowing them to draw directly on the canvas . Again this works well until such time as the canvas is refreshed, in which case the drawing disappears. I am guessing I need to save the canvas before any additional processing. Hope this helps
Thanks for the reply
I am using the TTree components for users to map out farms and overlay building, pens and other features, using TTreeNodeShapes. This is all working very well. The background is an overhead image of the farm from Google Earth that is used as a template. Some features on the farm I do not need to save as a TreeNodeShape as they have no attached objects.Streams and paths are an example. In this case I am allowing them to draw directly on the canvas . Again this works well until such time as the canvas is refreshed, in which case the drawing disappears. I am guessing I need to save the canvas before any additional processing. Hope this helps
Hi mendelo,
Please use the OnAfterDraw or the OnBeforeDraw event to redraw your users objects: e.g.
Regards,
tom
Please use the OnAfterDraw or the OnBeforeDraw event to redraw your users objects: e.g.
Code: Select all
procedure TForm2.Tree1BeforeDraw(Sender: TObject);
begin
Tree1.Canvas.DoRectangle(Rect(0,0,50,50));
end;
procedure TForm2.Tree1AfterDraw(Sender: TObject);
begin
Tree1.Canvas.DoRectangle(Rect(50,50,100,100));
end;
tom