Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Rect.GetLocation method

Applies to: desktop apps only

The Rect::GetLocation method gets the coordinates of the upper-left corner of the rectangle.

Syntax

VOID GetLocation(
  [out]  Point* point
) const;

Parameters

point [out]

Type: Point*

Pointer to a Point object that receives the coordinates of the upper-left corner.

Return value

This method does not return a value.

Examples

This example creates a Rect object, gets the point of the upper-left corner of the rectangle, and then draws a rectangle and line from the upper-left corner to the point (0, 0).


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

   Pen pen(Color(255, 0, 0, 255));
   Point location;
   Rect rect(50, 40, 200, 50);

   // Get the location of the upper-left corner of the rectangle.
   rect.GetLocation(&location);

   // Draw the rectangle.
   graphics.DrawRectangle(&pen, rect);

   // Draw a line from the upper-left corner of the rectangle to (0, 0).
   graphics.DrawLine(&pen, location, Point(0, 0));
}

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
Point
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

Show: