Page 1 of 1

TeeCreateMetaFile

Posted: Sat Feb 25, 2012 6:12 am
by 16558763
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

Re: TeeCreateMetaFile

Posted: Mon Feb 27, 2012 9:52 pm
by 16558763
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