Rectangle Function

Declare Function Rectangle Lib "gdi32.dll" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

Rectangle draws a rectangular-shaped box on a graphics-capable device. The rectangle is drawn in the device's current drawing color and is filled using its current filling color and brush, if any. The function returns 0 if an error occured, or 1 if successful.

hdc
The device context of the object to draw on.
X1
The x coordinate of the rectangle's upper-left corner.
Y1
The y coordinate of the rectangle's upper-left corner.
X2
The x coordinate of the rectangle's lower-right corner.
Y2
The y coordinate of the rectangle's lower-right corner.

Example:

' Draw a green rectangle on window Form1 with an upper-left
' corner of (25,30) and a lower-right corner of (100,50)
Dim retval As Long  ' return value

Form1.ForeColor = RGB(0, 255, 0)  ' set the foreground-drawing color to green
retval = Rectangle(Form1.hdc, 25, 30, 100, 50)  ' draw the rectangle from (25,30)-(100,50)

See Also: RoundRect
Category: Filled Shapes

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/r/rectangle.html