RectF.Contains(REAL, REAL) method
Applies to: desktop apps only
The RectF::Contains method determines whether the point (x, y) is inside this rectangle.
Syntax
BOOL Contains(
[in] REAL x,
[in] REAL y
);
Parameters
x [in]
Type: REALReal number that specifies the x-coordinate of the point to be tested.
y [in]
Type: REALReal number that specifies the y-coordinate of the point to be tested.
Return value
Type:
Type: BOOL
If the point to be tested (x, y) is inside this rectangle, this method returns TRUE; otherwise, it returns FALSE.
Examples
The following example creates a RectF object, determines whether a specified point is inside the RectF object, and then draws the rectangle and the specified point.
VOID Example_ContainsXY(HDC hdc)
{
Graphics graphics(hdc);
// Create a RectF object.
RectF rect(50, 50, 200, 100);
// Determine whether a specified point is inside the rectangle.
if(rect.Contains(80, 90))
{
// The point (80, 90) is inside rectangle.
}
// Draw the rectangle and the point (80, 90).
Pen pen(Color(255, 0, 0, 255));
graphics.DrawRectangle(&pen, rect);
graphics.DrawRectangle(&pen, 80, 90, 1, 1);
}
Requirements
Minimum supported client |
Windows XP, Windows 2000 Professional |
Minimum supported server |
Windows 2000 Server |
Product |
GDI+ 1.0 |
Header |
Gdiplustypes.h (include Gdiplus.h) |
Library |
Gdiplus.lib |
DLL |
Gdiplus.dll |
See also
Using a Pen to Draw Lines and Rectangles
Send comments about this topic to Microsoft
Build date: 3/6/2012