Windows Dev Center

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.GetRight method

Applies to: desktop apps only

The Rect::GetRight method gets the x-coordinate of the right edge of the rectangle.

Syntax

INT GetRight() const;

Parameters

This method has no parameters.

Return value

Type:

Type: INT

This method returns the x-coordinate of the right edge of the rectangle.

Examples

The following example creates a Rect object, gets the right edge of the rectangle, and then draws the rectangle and a line along the right edge of the rectangle.


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

   // Create a rect object, and get the right edge of the rectangle.
   Rect rect(50, 50, 200, 100);
   INT right = rect.GetRight();

   // Draw the rectangle with a thick green pen.
   Pen greenPen(Color(255, 0, 255, 0), 15);
   graphics.DrawRectangle(&greenPen, rect);

   // Draw a thin black line along the right edge of the rectangle.
   Pen blackPen(Color(255, 0, 0, 0), 1);
   graphics.DrawLine(&blackPen, right, 0, right, 200);
}

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

Show:
© 2015 Microsoft