Ellipse and Rectangle Functions
While the Ellipse can be drawn by passing the last four parameters of the Arc function as zeroes, a function Ellipse do exists with the Windows API and which can be utilized for drawing the ellipse.
The function, as defined below, takes five parameters, the first one being the handle to the device context. The next four parameters are the X and Y co-ordinates of the Top-Left and the Bottom-Right corners fo the Rectangle that bounds the ellipse.
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, _
ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
With rectangle ruling a large number of WinAPI functions how can we forget describing a function that can draw a Rectangle. That happens with Rectangle function and it takes same set of parameter as the Ellipse function above.
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, _
ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Don't search for a Windows API function for drawing a Circle or a Square as they are special cases of Ellipse and Rectangle respectively.



April 28th, 2007 - 10:44
Peace people
We love you