Paint on Canvas Example

procedure TForm.BtnClick(Sender: TObject);

{Make a bitmap of the Plot.}

var background:TBitmap;

begin

background:=TBitmap.Create;

with background do

begin {size the background bitmap and copy the energy graph to it.}

width:=Plot.width;

height:=Plot.height;

canvas.brush.color:=Form.color; {Make sure the gutter has the right color}

canvas.pen.color:=Form.color;

canvas.rectangle(0,0,width,height);

canvas.pen.color:=clBlack;

Plot.PaintGraph(canvas); {Puts the Plot on the background.canvas}

end;

end;