Rect::Equals method (gdiplustypes.h)

The Rect::Equals method determines whether two rectangles are the same.

Syntax

BOOL Equals(
  [in] const Rect & rect
);

Parameters

[in] rect

Type: const Rect&

Reference to a rectangle to compare to this rectangle.

Return value

Type: BOOL

If the rectangles are the same, this method returns TRUE; otherwise, it returns FALSE.

Remarks

Two rectangles are the same if their X, Y, Width, and Height data members are the same.

Examples

The following example creates two Rect objects, moves the second Rect object horizontally by a specified value, and then determines whether the two Rect objects are the same.

Rect rect1(50, 50, 200, 100);
Rect rect2(20, 50, 200, 100);

rect2.Offset(30, 0);

if(rect2.Equals(rect1))
{
   // The two rectangles are the same.
}

Requirements

   
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplustypes.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Pens, Lines, and Rectangles

Rect

RectF

Using a Pen to Draw Lines and Rectangles