Printing Annotations

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Chris Williams
Newbie
Newbie
Posts: 1
Joined: Fri Aug 01, 2003 4:00 am

Printing Annotations

Post by Chris Williams » Tue Dec 16, 2003 12:18 pm

Any suggestions as to why I cannot print annotations even though they are visible in the print preview window. I'm using Ver 6.01 with Delphi 7

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 16, 2003 3:29 pm

Perhaps the problem is you're using "screen pixel coordinates" to position custom elements, etc. While this is fine for screen, it does not work so well for printing. The reason for this is internal TeeChart printing algorithm adjusts Chart size (for proportional printing). During this process custom positioned items keep the same coordinates. The end result is all custom object will generally not be on correct place when printed.

The workaround is to use alternative approach to print chart:

Code: Select all

var tmpMeta: TMetaFile;
OldColor : TColor;
begin
    Chart1.BevelOuter := bvNone;
    OldColor := Chart1.Color;
    Chart1.Color := clNone;
    tmpMeta := Chart1.TeeCreateMetafile(true,Chart1.ClientRect);
    try
        Printer.Orientation := poLandscape;
        Printer.BeginDoc;
        try
            Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth - 1,
Printer.PageHeight - 1),tmpMeta);
        finally
            Printer.EndDoc;
        end;
    finally
        tmpMeta.Free;
        Chart1.BevelOuter := bvRaised;
        Chart1.Color := OldColor;
    end;
end;

Josep Lluis Jorge
http://support.steema.com

Post Reply