🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.graphics
1 messages
1 total messages Started by JUN Wed, 19 Nov 2008 05:41
wmf and FillRgn
#312
Author: JUN
Date: Wed, 19 Nov 2008 05:41
49 lines
2447 bytes
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...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads