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

Applies to: desktop apps only

The Rect::GetTop method gets the y-coordinate of the top edge of the rectangle.

Syntax

INT GetTop() const;

Parameters

This method has no parameters.

Return value

Type:

Type: INT

This method returns the y-coordinate of the top edge of the rectangle.

Examples

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


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

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

   // 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 at the top of the rectangle.
   Pen blackPen(Color(255, 0, 0, 0), 1);
   graphics.DrawLine(&blackPen, 0, top, 300, top);
}

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