RectShape.Contains

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

RectShape.Contains(X as Double, Y as Double) As Boolean

Supported for all project types and targets.

Tests whether the object contains the point X, Y. Returns True if the rectangle contains the point specified by X, Y.

Sample Code

This code tests whether the RectShape contains the passed point:

Var r As New RectShape
r.Width = 75
r.Height = 75
r.Border = 100
r.Bordercolor = RGB(0, 0, 0) // black
r.FillColor = RGB(0, 127, 127) // teal
r.BorderWidth = 2.5
r.Rotation = -0.78
If r.Contains(50, 50) Then
// draw something here..
End If
g.DrawObject(r, 100, 100)