1

I would like to know if there is a simple way to draw an arc like in JAVA the drawArc method on Windows Phone.

I would like to be able to do something like in this thread : How can I draw a circle sector with the ellipse class? , but in a programmatic way.
I try to use Path, PathGeometry or Ellipse classes but I guess there must be something more simple.

Thank you

EDIT : I did this but I don't understand why my arc is not filled up correctly, if someone have a clue don't hesitate to share.

  public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
    {

        try
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                lock (this.UIElements)
                {
                    Arc currentArc = new Arc();
                    currentArc.Height = (double)height;
                    currentArc.Width = (double)width;
                    currentArc.StartAngle = startAngle;
                    currentArc.EndAngle = arcAngle;
                    //Here I fill the Arc
                    currentArc.ArcThickness = 999;
                    currentArc.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
                    //                     
                    Canvas.SetLeft(currentArc, x);
                    Canvas.SetTop(currentArc, y);
                    Debug.WriteLine("fillArc hit ! Start Angle : " + startAngle + " End angle : " + arcAngle );
                    this.UIElements.Add(currentArc);
                }
            });

        }
        catch (Exception e)
        {
            Debug.WriteLine(e.Message);
        }
    }

EDIT 2: Code updated --> working

Community
  • 1
  • 1
Yann
  • 71
  • 8

1 Answers1

0

Add Microsof.Expression.Drawing assembly to your project, and you will have the Arc class available in your project.

To add the assembly to the project: Right click on References -> Add reference -> Extensions -> Select Microsoft.Expression.Drawing -> OK

Arc class resides in Microsoft.Expression.Shapes namespace.

anderZubi
  • 6,414
  • 5
  • 37
  • 67