I have winform project in c#. There is arc shape created in Autocad. I want to create the same shape on form with the paint event. I get the coordinates, radius and angles infos of the shapes with autocad List command.
The DrawArc
method takes 4 parameters: 1-The pen. 2-Rectangle to draw in. 3-Start angle. 4-Sweep angle.
I could not match these parameters with the information you see on the right side of the picture below.
This is the shape and infos
These are my codes:
private void Form1_Paint(object sender, PaintEventArgs e)
{
float X1 = 73.7153F;
float Y1 = 36.0911F;
float X2 = 271.4735F;
float Y2 = 315.4934F;
float width = X2 - X1;
float height = Y2 - Y1;
// Changes the coordinates Y axis accrording to form coordinates
Y2 = 36.0911F;
Y1 = 315.4934F;
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create start and sweep angles .
float startAngle = 195.0F;
float sweepAngle = 95.0F;
// Draw arc to screen.
e.Graphics.DrawArc(blackPen , X1, Y1, width, height, startAngle, sweepAngle);
}
This is the result: