Page 1 of 1

TeeCreateMetaFile

Posted: Wed Mar 03, 2004 9:43 am
by 8576420
:?
Hi NG,
This is the code triying to print a TDBChart with custom drawing:

tmpMeta:= DBChart1.TeeCreateMetafile(true,DBChart1.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;
DBChart1.BevelOuter := bvRaised;
DBChart1.Color := OldColor;
true;
end;
the effect is that i only get the TDBchart printed, the custom drwaing is not in the emf File nor on the printout.

The following code is working, but with bad quality:

tmpBMP:= TBitmap.Create;
tmpBMP.PixelFormat := pfDevice;
tmpBMP.Assign( (DBChart1.Canvas as TTeeCanvas3D).Bitmap);
try
Printer.Orientation := poLandscape;
Printer.BeginDoc;
try
Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth- 1,Printer.PageHeight-1),tmpBMP);
finally
Printer.EndDoc;
end;
finally
tmpMeta.free;
DBChart1.BevelOuter := bvRaised;
DBChart1.Color := OldColor;
true;
end;

What is going wrong there ??? I have tried different Rects like TDBChart.boundsRect etc.