Java drawArc() method on Windows phone
本文关键字:on Windows phone method drawArc Java | 更新日期: 2023-09-27 18:24:47
我想知道是否有一种简单的方法可以像JAVA中的drawArc
方法一样在Windows Phone上绘制圆弧。
我希望能够在这个线程中做一些类似的事情:如何用椭圆类绘制圆形扇区,但是以程序化的方式
我尝试使用Path
、PathGeometry
或Ellipse
类,但我想一定有更简单的类。
谢谢
编辑:我这样做了,但我不明白为什么我的弧线没有正确填充,如果有人有线索,请毫不犹豫地分享。
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:代码更新-->工作
将Microsof.Expression.Drawing
程序集添加到您的项目中,您的项目中将提供Arc
类。
要将程序集添加到项目中:右键单击引用->添加引用->扩展->选择Microsoft.Expression.Drawing->确定
Arc
类驻留在Microsoft.Expression.Shapes
命名空间中。