I have a task in which I have to draw a Figure of Eight, so I thought of it as drawing four arcs. I tried using the DrawArc
method but I really don't understand how does it work at all.
The DrawArc
method takes 4 parameters:
1-The pen.
2-Rectangle to draw in.
3-Start angle.
4-Sweep angle.
What I don't get is the start and sweep angle, could anybody with knowledge tell me what are these 2 parameters and how do they effect the drawing ?
Also does giving the rectangle parameter takes the (0,0) as starting point.
Edit:
I have tried the following code:
e.Graphics.DrawArc(drawPen, 0, 0, 600, 400, 45, 90);
e.Graphics.DrawArc(drawPen, 0, 345, 600, 400, -45, -90);
which resulted in the following:
I would like to make it larger, I have played with the code but not success, I didn't understand what I am doing, I was just changing numbers, that is why I asked for an explanation.
drawArc. Draws the outline of a circular or elliptical arc covering the specified rectangle. The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color.
The DrawArc method takes 4 parameters: 1-The pen. 2-Rectangle to draw in. 3-Start angle. 4-Sweep angle.
Using the 3-point ellipse tool, you can draw an ellipse by first drawing its centerline and then drawing its height. This method lets you draw ellipses at an angle.
sweep angle = 90 degrees. In the above diagram, shaded portion is the rendered arc portion.As you can see, It starts from 0 degrees as depicted in the coordinate system, and it sweeps 90 degrees in clockwise direction. Case 2: startAngle = 90 degrees. sweep angle = 180 degrees.
you imagine 2-D Coordinate axes and clockwise rotation ,
Start angle : shows the point where you want to start drawing from X axes
Sweep angle : measure of clockwise rotation ,
also MSDN Said:
startAngle: Angle in degrees measured clockwise from the x-axis to the starting point of the arc.
sweepAngle: Angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.
for example : Horizantal Arc and Vertical Arc :
switch (ArcType)
{
case ArcType.Horizantal :
g.DrawArc(Pens.Black, 0, 15, 15, 15, 0, -180);
break;
case ArcType.Vertical:
g.DrawArc(Pens.Black, 0, 15, 15,15, -90,180);
break;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With