Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

The behavior of ppImage with EMF

Hi, there

I want to print some graphs dynamically at running time.
I draw then graph on canvas and save them as EMF file and then
assign them to the ppimage.picture.
I am annoying with the following drawing. ppImage can not be print
correctly with EMF that use FloodFill command.
What is the different between FillRect and FloodFill?

var
MetaFile: TMetafile;
//canvas
MFCanvas: TMetafileCanvas;
lDC: THandle;
begin
MetaFile := TMetafile.Create;
try
MetaFile.Width := 500;
MetaFile.Height:= 500;
//
lDC := GetDC(0);
MFCanvas := TMetafileCanvas.Create(MetaFile, lDC);
try
MFCanvas.Pen.Color := clBlack;
MFCanvas.Pen.Width := 1;
//
MFCanvas.Rectangle(10, 10, 400, 110);
MFCanvas.Rectangle(10, 210, 400, 310);

//style
MFCanvas.Brush.Style := bssolid;
//color
MFCanvas.Brush.Color := RGB(255,255,0);
//The following is OK
MFCanvas.FillRect(rect(11,11,399,109));

MFCanvas.Brush.Color := RGB(255,0,255);
//The following can not be draw when printing, but display normally at preview
MFCanvas.FloodFill(20,250,clBlack,fsBorder);

finally
MFCanvas.Free;
end;

//save to file
MetaFile.SaveToFile('D:\testEMF.emf');
finally
MetaFile.Free;
end;

end;

Thanks for your information

regards

Yong

Comments

Sign In or Register to comment.