Friday, 2 June 2017

Saving a barchart to a bmp file from the Lazarus barchart object

procedure TForm1.Button2Click(Sender: TObject);
var
tmpbitmap :TBitmap;

begin
tmpbitmap := TBitmap.create;
  tmpbitmap.Width :=Chart1.Width;
    tmpbitmap.Height:=Chart1.Height;
    tmpbitmap.Canvas.copyrect(Rect(0,0,Chart1.Width,Chart1.Height), Chart1.canvas, rect(0,0,tmpbitmap.width,tmpbitmap.height));

if savedialog1.execute then
begin
tmpbitmap.savetofile(savedialog1.filename);
end;
tmpbitmap.free;
end;      

No comments:

Post a Comment