C# 如何在windows phone中动态绘制扇区(四分之一圆)?
我想画出如图所示的形状。我已经用弧段画了半圆,现在我想画四分之一圆,或扇形,但我不能画 我用这段代码画圆弧,我试图改变大小,角度也不起作用 我应该怎样画四分之一圆/扇区??我用来画弧的代码是:C# 如何在windows phone中动态绘制扇区(四分之一圆)?,c#,silverlight,windows-phone,C#,Silverlight,Windows Phone,我想画出如图所示的形状。我已经用弧段画了半圆,现在我想画四分之一圆,或扇形,但我不能画 我用这段代码画圆弧,我试图改变大小,角度也不起作用 我应该怎样画四分之一圆/扇区??我用来画弧的代码是: PathFigure pthFigure1 = new PathFigure(); pthFigure1.StartPoint = new Point(50, 60);// starting cordinates of arcs ArcSegment arcSeg1 = new ArcSegment();
PathFigure pthFigure1 = new PathFigure();
pthFigure1.StartPoint = new Point(50, 60);// starting cordinates of arcs
ArcSegment arcSeg1 = new ArcSegment();
arcSeg1.Point = new Point(100, 82); // ending cordinates of arcs
arcSeg1.Size = new Size(10, 10);
arcSeg1.IsLargeArc = false;
arcSeg1.SweepDirection = SweepDirection.Clockwise;
arcSeg1.RotationAngle = 90;
PathSegmentCollection myPathSegmentCollection1 = new PathSegmentCollection();
myPathSegmentCollection1.Add(arcSeg1);
pthFigure1.Segments = myPathSegmentCollection1;
PathFigureCollection pthFigureCollection1 = new PathFigureCollection();
pthFigureCollection1.Add(pthFigure1);
PathGeometry pthGeometry1 = new PathGeometry();
pthGeometry1.Figures = pthFigureCollection1;
System.Windows.Shapes.Path arcPath1 = new System.Windows.Shapes.Path();
arcPath1.Data = pthGeometry1;
arcPath1.Fill = new SolidColorBrush(Color.FromArgb(255, 255, 23, 0));
this.LayoutRoot.Children.Add(arcPath1);
代码更改最少(
/***/
表示更改或添加的行)
您似乎没有解释ArcSegment.RotationAngle
的含义
它的数学:
PathFigure pthFigure1 = new PathFigure();
/**/ pthFigure1.StartPoint = new Point(0, 100);// starting cordinates of arcs
ArcSegment arcSeg1 = new ArcSegment();
/**/ arcSeg1.Point = new Point(100, 0); // ending cordinates of arcs
/**/ arcSeg1.Size = new Size(100, 100);
arcSeg1.IsLargeArc = false;
arcSeg1.SweepDirection = SweepDirection.Clockwise;
/**/ LineSegment lineSeg = new LineSegment();
/**/ lineSeg.Point = new Point(100,100);
PathSegmentCollection myPathSegmentCollection1 = new PathSegmentCollection();
myPathSegmentCollection1.Add(arcSeg1);
/**/ myPathSegmentCollection1.Add(lineSeg);
pthFigure1.Segments = myPathSegmentCollection1;
PathFigureCollection pthFigureCollection1 = new PathFigureCollection();
pthFigureCollection1.Add(pthFigure1);
...