Quote:
>I want to put an ellipse in the box. I just don't know the math required
>to generate it. If anyone can help with where I could get mathematical
>functions to create curved lines it would be great.
Well, I could give you the mathematical formulas, but in VB you don't
really need them to draw ellipses.
Just look in the Programmer's Guide, chapter 15. You use the command
"circle" to draw arcs. To get an ellipse instead of a circle, just
fill in the optional parameter "aspect". This is the ratio of y
compared to x. "Radius" is the larger of the two. By giving in a start
and an end angle, you can even draw only a part of the ellipse! The
one limitation is that your ellipse must stretch either horizontally,
or vertically. But that isn't really a problem, is it?
Anyway, you asked for it, so here are's the math:
Coordinates for one point:
x=mx+l*cos(angle)
y=my+h*sin(angle)
with angle in radians (=PI radians for 180). 0 gives a point at 3
o'clock, PI/2 gives you 12 o'clock.
Here is:
(mx,my) = your middle point,
l = horizontal distance ellipse to middlepoint
h = vertical distance ellipse to middlepoint
All you have to do is to plot different points for several angles.
Better still, draw some straight lines between some calculated points.
Just make sure these points are close enough together.
The same limitation applies: if you do want the ellipse to stretch
some other direction than either horizontally or vertically, you'd
have to use rotation formulas (some combination of sines and cosines).
But I won't bother you with those now.
Hope I got you started,
Bart