Rect.GetBounds method

Applies to: desktop apps only

The Rect::GetBounds method makes a copy of this rectangle.

Syntax

VOID GetBounds(
  [out]  Rect* rect
) const;

Parameters

rect [out]

Type: Rect*

Pointer to a Rect object that receives the copy of this rectangle.

Return value

This method does not return a value.

Examples

The following example creates a Rect object, offsets the rectangle, creates a second Rect object by using a copy of the first rectangle, and then draws the second Rect object.


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

   Rect rect1(50, 40, 200, 100);
   rect1.Offset(30, 20);

   Rect rect2;
   rect1.GetBounds(&rect2);

   Pen pen(Color(255, 0, 0, 255));
   graphics.DrawRectangle(&pen, rect2);
}

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

Rect
Rect::GetBottom
Rect::GetLeft
Rect::GetRight
Rect::GetTop
RectF
Using a Pen to Draw Lines and Rectangles
Pens, Lines, and Rectangles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.