IGxRectF.IntersectsWith

Syntax

IntersectsWith(Rect: IGxRectF): Boolean;

Parameters

Rect - real rectangle, with which it is necessary to check the intersection.

Description

The IntersectsWith method returns True if this real rectangle intersects the rectangle passed by the Rect parameter.

Example

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Obj, Obj1: ITabObject;

RectF, RectF1: IGxRectF;

s: String;

Begin

RectF:=New GxRectF.Create(0,0,Math.RandBetween(0,30),Math.RandBetween(0,30));

RectF1:=New GxRectF.Create(Math.RandBetween(0,15),Math.RandBetween(0,15),Math.RandBetween(0,30),Math.RandBetween(0,30));

Obj:=UiTabSheet1.TabSheet.Objects.Add("PrxPicture", RectF);

Obj1:=UiTabSheet1.TabSheet.Objects.Add("PrxPicture", RectF1);

(Obj As IPrxPicture).Image:=GxImage.FromFile("c:\1.bmp");

(Obj1 As IPrxPicture).Image:=GxImage.FromFile("c:\2.bmp");

If RectF.IntersectsWith(RectF1) Then

s:="Yes";

Else

s:="No";

End If;

End Sub Button1OnClick;

After executing the example clicking the button creates two images in the regular report. Image sources are the 1.bmp and 2.bmp files. The "s" variable contains Yes if the real rectangle that bounds the first image intersects the rectangle that bounds the second image.

See also:

IGxRectF