IGxRect.Contains

Syntax

Contains(X: Integer, Y: Integer): Boolean;

Parameters

X. The X coordinate of the point.

Y. The Y coordinate of the point.

Description

The Contains method checks if the integer rectangle contains the point.

Comments

Available values:

Example

Executing the example requires:

Add links to the Drawing, Forms, MathFin, Report, Tab, UI system assemblies.

The example is a handler of the OnClick event for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Obj: ITabObject;
    Tab: ITabSheet;
    Rect: IGxRect;
    X, Y: Integer;
Begin
    
// Create a new rectangle with specified sizes
    Rect := New GxRect.Create(005045);
    Tab := UiTabSheet1.TabSheet;
    
// Add an image to the created rectangle
    Obj := Tab.Objects.Add("PrxPicture", Rect.ToRectF);
   (Obj 
As IPrxPicture).Image := GxImage.FromFile("c:\1.bmp");
   
// Set point with random coordinates
    X := Math.RandBetweenI(070);
    Y := Math.RandBetweenI(
070);
    
// Check that point enters to the rectangle
    If Rect.Contains(X, Y) Then
        WinApplication.InformationBox(
"Yes");
    
Else
        WinApplication.InformationBox(
"No");
End If;
End Sub Button1OnClick;

After executing the example clicking the Button1 button creates an image in the regular report. The image source is the 1.bmp file. The information window contains Yes if the point with the random coordinates is included to the rectangle that bounds the image.

See also:

IGxRect