Search code examples
delphiprintingteechart

Delphi 7: How to print a TChart?


How do I print a TChart?

I displayed a TChart, and there is a TButton in the screen.

When the TButton clicked, Windows Printer Dialog will be shown and the TChart will be printed to the selected printer.

How can I do that using Delphi 7?

Thanks.


Solution

  • This is very easy:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      with TPrintDialog.Create(nil) do
        try
          if Execute then
            Chart1.Print;
        finally
          Free;
        end;
    end;