RoundRect Function

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

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

RoundRect draws a rectangle with rounded corners on a graphics-capable device. The rounded rectangle is drawn in the device's current drawing color and is filled using its current filling color and brush, if any. The first two (x,y) coordinate pairs specified are the upper-left and lower-right corners of a comparable square-cornered rectangle. The third pair specifies the width and height of the rounded corner to use. 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 upper-left corner of the corresponding square-edged rectangle.
Y1
The y coordinate of the upper-left corner of the corresponding square-edged rectangle.
X2
The x coordinate of the lower-right corner of the corresponding square-edged rectangle.
Y2
The y coordinate of the lower-right corner of the corresponding square-edged rectangle.
X3
The width of each rounded corner.
Y3
The height of each rounded corner.

Example:

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

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

Related Call: Rectangle
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/roundrect.html