ArcControl.ArcHelper.GetCircleSegment C# (CSharp) Метод

GetCircleSegment() публичный статический Метод

public static GetCircleSegment ( Point centerPoint, double radius, double angle ) : Path
centerPoint Point
radius double
angle double
Результат Windows.UI.Xaml.Shapes.Path
        public static Path GetCircleSegment(Point centerPoint, double radius, double angle)
        {
            var path = new Path();
            var pathGeometry = new PathGeometry();

            var circleStart = new Point(centerPoint.X, centerPoint.Y - radius);

            var arcSegment = new ArcSegment
            {
                IsLargeArc = angle > 180.0,
                Point = ScaleUnitCirclePoint(centerPoint, angle, radius),
                Size = new Size(radius, radius),
                SweepDirection = SweepDirection.Clockwise
            };

            var pathFigure = new PathFigure
            {
                StartPoint = circleStart,
                IsClosed = false
            };

            pathFigure.Segments.Add(arcSegment);
            pathGeometry.Figures.Add(pathFigure);

            path.Data = pathGeometry;
            return path;
        }

Usage Example

Пример #1
0
        private void Draw()
        {
            Children.Clear();

            Path radialStrip = ArcHelper.GetCircleSegment(GetCenterPoint(), Radius, GetAngle());

            radialStrip.Stroke          = new SolidColorBrush(Fill);
            radialStrip.StrokeThickness = Thickness;

            Children.Add(radialStrip);
        }