'calculate the radius for intWidth and intHeight
intHeight = intHeight / 2
intWidth = (intWidth / 2) - intHeight
'calculate the starting point of the ellipse
sngTiltX = Sin(sngTiltAngle * PIdiv180) * intWidth
sngTiltY = Cos(sngTiltAngle * PIdiv180) * intWidth
'draw the ellipse using one line for every three pixels
'This will increase drawing speed on small ellipses and produce
'detailed ones for large ellipses.
sngNumOfPoints = (2 * PI * (intWidth + intHeight)) / 4 '2.Pi.r = circumfrence, /4=per 4 pixels
'size the array to match the number of points to be calculated
ReDim udtEllipse(sngNumOfPoints)
'calculate the number of degrees between points
sngDegPerPoint = (360 / sngNumOfPoints)
For sngCounter = 0 To 360 Step sngDegPerPoint
sngMoveCenterX = intCenterX + (Cos(sngCounter * PIdiv180) * sngTiltX)
sngMoveCenterY = intCenterY + (Cos(sngCounter * PIdiv180) * sngTiltY)
'calculate the new position
sngCircleX = Sin((sngCounter + sngTiltAngle) * PIdiv180) * intHeight
sngCircleY = Cos((sngCounter + sngTiltAngle) * PIdiv180) * intHeight
'add the points
udtEllipse(Round(sngCounter / sngDegPerPoint)).X = sngMoveCenterX + sngCircleX
udtEllipse(Round(sngCounter / sngDegPerPoint)).Y = sngMoveCenterY + sngCircleY
Next sngCounter