IntersectsWith(Rect: IGxRect): Boolean;
Rect - integer rectangle, with which it is necessary to check the intersection.
The Intersect method returns True if this integer rectangle intersects the rectangle that is passed by the Rect parameter.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Obj, Obj1: ITabObject;
Rect, Rect1: IGxRect;
s: String;
Begin
Rect:=New GxRect.Create(0,0,Math.RandBetweenI(0,30),Math.RandBetweenI(0,30));
Rect1:=New GxRect.Create(Math.RandBetweenI(0,15),Math.RandBetweenI(0,15),Math.RandBetweenI(0,30),Math.RandBetweenI(0,30));
Obj:=UiTabSheet1.TabSheet.Objects.Add("PrxPicture", Rect.ToRectF);
Obj1:=UiTabSheet1.TabSheet.Objects.Add("PrxPicture", Rect1.ToRectF);
(Obj As IPrxPicture).Image:=GxImage.FromFile("c:\1.bmp");
(Obj1 As IPrxPicture).Image:=GxImage.FromFile("c:\2.bmp");
If Rect.IntersectsWith(Rect1) 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 integer rectangle bounding the first image intersects the rectangle bounding the second image.
See also: