I have a printing tool, that issues a callback when a user drawn object has to be drawn. One of these parameters is a HCD (handle to device context). Now my question:
How can I attach TeeChart to a specific Device Context or is there another possibility to do an output of a chart into a DC?
Printing a chart into a DC
-
- Newbie
- Posts: 1
- Joined: Sun Nov 02, 2003 5:00 am
- Location: Linz/Austria
Hello,
Here's an example that prints a TeeChart to a Form using the Form handle:
Regards,
Marc Meumann
Here's an example that prints a TeeChart to a Form using the Form handle:
Code: Select all
procedure TForm1.PrintToHandle(DC: HDC; Left, Top, Right, Bottom: Integer);
var tmp:TCanvas;
SaveIndex: Integer;
begin
tmp:=TCanvas.Create;
SaveIndex:=SaveDC(DC);
tmp.Handle:=DC;
Chart1.PrintPartialCanvas(tmp,Rect(Left,Top,Right,Bottom));
tmp.Free;
RestoreDC(DC, SaveIndex);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PrintToHandle(Form1.Canvas.Handle,0,0,Chart1.Width,Chart1.Height);
end;
Marc Meumann
Steema Support