Jalaj P. Jha Technical & Miscellaneous Ramblings

21Feb/071




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.

Comments (1) Trackbacks (0)
  1. Peace people

    We love you


Leave a comment


No trackbacks yet.