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)

Related Call: RoundRect
Category: Filled Shapes
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/r/rectangle.html