I Can't Answer This Question, But ...
好象是与参数类型的不同定义有关,
什么 Dynamic arrays,什么 Open array 等等等等???
要请高人解答!!!
如果你弄同了,麻烦告诉我,那些 Help 实在没有耐心看下去了!(又臭又长!)
=====================================================================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
rgn:hrgn;
type
PPoints = ^TPoints;
TPoints = array[0..0] of TPoint;
TP = array of TPoint;
var
P: PPoints;
pary: TP;
function CreatePolyRgn(var Points: TP): HRgn;
type
PPoints = ^TPoints;
TPoints = array[0..0] of TPoint;
begin
Result := CreatePolygonRgn(PPoints(Points)^, High(Points) + 1, WINDING);
end;
begin
canvas.brush.color:=clred;
setlength(pary,4);
pary[0]:=point(0,0);
pary[1]:=point(180,0);
pary[2]:=point(180,180);
pary[3]:=point(0,180);
try
rgn:=CreatePolyRgn(Pary);
if rgn<>0 then
fillrgn(canvas.handle,rgn,canvas.brush.handle)
else
showmessage('invalid region');
finally
deleteobject(rgn);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var pary:array of tpoint;
i:integer;
rgn:hrgn;
type
PPoints = ^TPoints;
TPoints = array[0..0] of TPoint;
var
P: PPoints;
// Copy From RXHints.pas
function CreatePolyRgn(const Points: array of TPoint): HRgn;
type
PPoints = ^TPoints;
TPoints = array[0..0] of TPoint;
begin
Result := CreatePolygonRgn(PPoints(@Points)^, High(Points) + 1, WINDING);
end;
begin
canvas.brush.color:=clBlue;
setlength(pary,4);
pary[0]:=point(0,0);
pary[1]:=point(180,0);
pary[2]:=point(180,180);
pary[3]:=point(0,180);
try
rgn:=CreatePolyRgn(Pary);
if rgn<>0 then
fillrgn(canvas.handle,rgn,canvas.brush.handle)
else
showmessage('invalid region');
finally
deleteobject(rgn);
end;
end;
end.