RectF::Equals method (gdiplustypes.h)

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

Syntax

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

Parameters

[in] rect

Type: const RectF&

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 RectF objects, moves the second RectF object horizontally by a specified value, and then determines whether the two RectF objects are the same.

VOID Example_Equals(HDC hdc)
{
   Graphics graphics(hdc);

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

   rect2.Offset(30, 0);

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

Requirements

Requirement Value
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