TeeCreateMetaFile

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jredoc
Newbie
Newbie
Posts: 7
Joined: Mon Mar 14, 2011 12:00 am

TeeCreateMetaFile

Post by jredoc » Sat Feb 25, 2012 6:12 am

Hello

The following code excerpt worked fine in a Delphi XE in Windows 7 64 bit development environment.

procedure TDataHygiene.ExecuteHygieneReport1;
var
MetaFile1: TMetaFile; // Requires graphics unit
Rect1: TRect;
begin
ChartMoveAv := TChartMoveAv.Create(Application);

Rect1.Left := 0;
Rect1.Top := 0;
Rect1.Right := ppImage1.spWidth;
Rect1.Bottom := ppImage1.spHeight;

MetaFile1 := ChartMovAv.ChartMoveAv.Chart1.TeeCreateMetafile(True, Rect1);

ppImage1.Visible := True;
ppImage1.Clear;
ppImage1.Picture.Metafile.Assign(MetaFile1);

ChartMoveAv.Close;
end;

a)
In Dephi XE2 32 bit the first compiler error was: incompatible types: 'TRectF' and 'TRect'

I added the Types unit to the uses clause and declared - Rect1: TRectF;

b)
The next compiler error was : Incompatible types: 'Vcl.Graphics.TMetaFile and 'FMXTee.Procs.TMetafile'

Interestingly, code site states that the return of the function TeeCreateMetaFile is TMetaFile. I conceptually understand that the compiler is saying the return value is not a VCL.Graphics.TMetaFile but am at a loss as to how to resolve the issue.

TIA

John

jredoc
Newbie
Newbie
Posts: 7
Joined: Mon Mar 14, 2011 12:00 am

Re: TeeCreateMetaFile

Post by jredoc » Mon Feb 27, 2012 9:52 pm

Interestingly, the solution was to eliminate the Metafile component entirely and substitute a) for b)

a) ppImage1.Picture.Metafile.Assign(ChartMoveAv.Chart1.TeeCreateMetafile(True, Rect1));

b) ppImage1.Picture.Metafile.Assign(MetaFile1);


I do not unfortunately, have an explanation as to why the original code "b)" does not work. Does anyone?

John

Post Reply