I wish to develop a custom graphic object/component that embeds a TChart (just the Chart Rectangle that is). In its most simple form, it would look like show below.
Note I have shrunk the "graph" slightly in order to show all borders. Other (derived) objects will be more complex, obviously.
The idea is that the ChartRect (re border area) of an "off-screen" TChart (memory) is either copied or drawn to a different canvas (controlled by the custom object/component).
So far I have tried to simply copy the ChartRect to a custom bitmap (TImage), but I have not been successful. The code I have used for this (in many variations) is attached to the button:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
aRect: TRect;
aBmp: TBitmap;
begin
Image1.Width := Chart1.Width;
Image1.Height := Chart1.Height;
Chart1.Canvas.UseBuffer := false;
aRect := Chart1.ChartRect;
aBmp := Chart1.TeeCreateBitmap(clWhite, aRect);
try
Image1.Picture.Bitmap.Assign(aBmp);
finally
aBmp.Free;
end;
end;
The first mistake I just made was to assume that the aRect in
Code: Select all
aBmp := Chart1.TeeCreateBitmap(clWhite, aRect)
Any steer in the right direction would be very welcome! I hope I described the issue clear enough, but if more info is required I will gladly supply it!
Thanks.