unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TPArray=Array[0..4]
of TPoint;
TForm1 =
class(TForm)
Image1: TImage;
Button1: TButton;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
private
Figure1:TPArray;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
FigReg,CircleReg:HRGN;
begin
Figure1[0].X := 0;
Figure1[0].Y := 0;
Figure1[1].X := 50;
Figure1[1].Y := 0;
Figure1[2].X := 50;
Figure1[2].Y := 50;
Figure1[3].X := 25;
Figure1[3].Y := 75;
Figure1[4].X := 0;
Figure1[4].Y := 50;
FigReg := CreatePolygonRgn(Figure1,5,WINDING);
CircleReg := CreateEllipticRgn(30,30,100,100);
if not (CombineRgn(FigReg,FigReg,CircleReg,RGN_AND)=NULLREGION)
then Showmessage('
Collision');
SetWindowrgn(Panel1.Handle,FigReg,true);
// Anzeige des Ergebnisses
Deleteobject(FigReg);
Deleteobject(CircleReg);
end;
end.