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