Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wmf and FillRgn

5 views
Skip to first unread message

JUN

unread,
Nov 19, 2008, 12:41:22 AM11/19/08
to
FillRgn seems can't work in WMF, code like follow:

procedure TForm1.Button1Click(Sender: TObject);
var
MetaFile: TMetaFile;
MFCanvas: TMetaFileCanvas;
MyRgn: HRGN;
p:ARRAY OF TPoint;
begin
setlength(p,4);
p[0]:=Point(10,10);
p[1]:=Point(100,10);
p[2]:=Point(100,100);
p[3]:=Point(10,100);

MetaFile := TMetaFile.Create;
try
MetaFile.Height := Self.Height;
MetaFile.Width := Self.Width;
MFCanvas := TMetafileCanvas.Create(MetaFile, 0);
try
MFCanvas.Brush.Color:=clRed;
MFCanvas.Brush.Style:=bsSolid;
MFCanvas.Pen.Color :=clGreen;
MFCanvas.Pen.Width := 3;

MFCanvas.Rectangle(102,100,200,200); // Normal -
it can display in office picture and Corel Paint Shop Pro


MyRgn := CreatePolygonRgn(PPoint(p)^, 4, WINDING); //
ERROR - it can display in office picture and can not display in Corel
Paint Shop Pro
FillRgn(MFCanvas.Handle, MyRgn, MFCanvas.Brush.Handle);
DeleteObject(MyRgn);


finally
MFCanvas.Free;
END;
MetaFile.SaveToFile('a.wmf');
ShowMessage('aaaaaa');
finally
MetaFile.Free;
END;

end;

thanks...

0 new messages