• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PathSegmentCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PathSegmentCollection的典型用法代码示例。如果您正苦于以下问题:C# PathSegmentCollection类的具体用法?C# PathSegmentCollection怎么用?C# PathSegmentCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PathSegmentCollection类属于命名空间,在下文中一共展示了PathSegmentCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Draw

        public static void Draw(Canvas canvas, List<LinePoint> points, Brush stroke, bool clear = true)
        {
            if (clear)
            {
                canvas.Children.Clear();
            }

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            PathGeometry myPathGeometry = new PathGeometry();

            foreach (LinePoint p in points)
            {
                PathFigure myPathFigure = new PathFigure();
                myPathFigure.StartPoint = p.StartPoint;

                LineSegment myLineSegment = new LineSegment();
                myLineSegment.Point = p.EndPoint;

                PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
                myPathSegmentCollection.Add(myLineSegment);

                myPathFigure.Segments = myPathSegmentCollection;

                myPathFigureCollection.Add(myPathFigure);
            }

            myPathGeometry.Figures = myPathFigureCollection;
            Path myPath = new Path();
            myPath.Stroke = stroke == null ? Brushes.Black : stroke;
            myPath.StrokeThickness = 1;
            myPath.Data = myPathGeometry;

            canvas.Children.Add(myPath);
        }
开发者ID:Eddie104,项目名称:Libra-CSharp,代码行数:34,代码来源:GraphicsHelper.cs


示例2: GetDefaultGlyph

        /// <summary>
        /// Returns the Glyph to display
        /// </summary>
        /// <returns>Glyph object</returns>
        private Geometry GetDefaultGlyph()
        {
            double x1 = this.columnHeader.ActualWidth - 13;
            double x2 = x1 + 10;
            double x3 = x1 + 5;
            double y1 = (this.columnHeader.ActualHeight / 2) - 3;
            double y2 = y1 + 5;

            if (this.direction == ListSortDirection.Ascending)
            {
                double tmp = y1;
                y1 = y2;
                y2 = tmp;
            }

            PathSegmentCollection pathSegmentCollection = new PathSegmentCollection();
            pathSegmentCollection.Add(new LineSegment(new Point(x2, y1), true));
            pathSegmentCollection.Add(new LineSegment(new Point(x3, y2), true));

            PathFigure pathFigure = new PathFigure(new Point(x1, y1), pathSegmentCollection, true);

            PathFigureCollection pathFigureCollection = new PathFigureCollection();
            pathFigureCollection.Add(pathFigure);

            PathGeometry pathGeometry = new PathGeometry(pathFigureCollection);
            return pathGeometry;
        }
开发者ID:modulexcite,项目名称:shelvesetcomparer,代码行数:31,代码来源:SortGlyphAdorner.cs


示例3: OnRender

        /*  将相邻两点连线
        protected override void OnRender(DrawingContext dc)
        {
            if (InternalChildren.Count < 2)
            {
                base.OnRender(dc);
                return;
            }

            Point? StartPoint = null;
            Point? EndPoint = null;

            for (int index = 0; index < InternalChildren.Count; index++)
            {
                UIElement CurChhild = this.Children[index];
                Vector CurV = VisualTreeHelper.GetOffset(CurChhild);

                if (index == 0)
                    StartPoint = new Point(CurV.X + CurChhild.RenderSize.Width / 2, CurV.Y + CurChhild.RenderSize.Height / 2);
                else
                    EndPoint = new Point(CurV.X + CurChhild.RenderSize.Width / 2, CurV.Y + CurChhild.RenderSize.Height / 2);

                if (StartPoint != null && EndPoint != null)
                {
                    dc.DrawLine(new Pen(LineBrush, 1.0), StartPoint.Value, EndPoint.Value);
                    StartPoint = EndPoint;
                }
            } 
        }
        */

        // 由LineSegment连接相邻两点并最终构成Path
        protected override void OnRender(DrawingContext dc)
        {
            if (InternalChildren.Count < 2)
            {
                base.OnRender(dc);
                return;
            }

            PathSegmentCollection segmentCollection = new PathSegmentCollection();
            PathFigure pathFigure = new PathFigure() { Segments = segmentCollection }; 

            for (int index = 0; index < InternalChildren.Count; index++)
            {
                UIElement CurChhild = this.Children[index];
                Vector CurV = VisualTreeHelper.GetOffset(CurChhild);

                if (index == 0)
                    pathFigure.StartPoint = new Point(CurV.X + CurChhild.RenderSize.Width / 2, CurV.Y + CurChhild.RenderSize.Height / 2);
                else
                    segmentCollection.Add(new LineSegment() { Point = new Point(CurV.X + CurChhild.RenderSize.Width / 2, CurV.Y + CurChhild.RenderSize.Height / 2) });
            }
 
            PathGeometry pathGeometry = new PathGeometry() { Figures = new PathFigureCollection() { pathFigure } };
            dc.DrawGeometry(Brushes.Transparent, new Pen(LineBrush, 1.0), pathGeometry);
        }
开发者ID:huangjia2107,项目名称:MyControls,代码行数:57,代码来源:PolylineGrid.cs


示例4: Superposition

        public Superposition()
        {
            InitializeComponent();
                        
            PathGeometry pathGeometry = new PathGeometry();
            PathFigure pathFigure = new PathFigure();
            
            pathFigure.StartPoint = new Point(0,0);

            PathSegmentCollection pathSegmentCollection = new PathSegmentCollection();

            int maxHeight = (int)this.Height;
            int maxWidth = (int)this.Width;
            Random rand = new Random();
            for (int i = 0; i < 500; i++)
            {
                LineSegment newSegment = new LineSegment();
                newSegment.Point = new Point(rand.Next(0, maxWidth), rand.Next(0, maxHeight));
                pathSegmentCollection.Add(newSegment);
            }

            pathFigure.Segments = pathSegmentCollection;
            pathGeometry.Figures.Add(pathFigure);

            pathBackground.Data = pathGeometry;


        }
开发者ID:Corantin,项目名称:Cegep,代码行数:28,代码来源:Superposition.xaml.cs


示例5: DrawBezier

        internal void DrawBezier(double thickness, Color color, Point startPoint, Point controlPoint, Point endPoint)
        {
            PathFigure myPathFigure = new PathFigure();
            myPathFigure.StartPoint = startPoint;

            BezierSegment myBezierSegment = new BezierSegment(startPoint, endPoint, controlPoint, true);

            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            myPathSegmentCollection.Add(myBezierSegment);

            myPathFigure.Segments = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();
            myPathGeometry.Figures = myPathFigureCollection;

            DrawingContext drawingContext = drawingVisual.RenderOpen();

            mySolidColorBrush.Color = color;
            //ApplyColortool(color.A);
            pen.Brush = mySolidColorBrush;
            pen.Thickness = thickness;

            drawingContext.DrawGeometry(null, pen, myPathGeometry);

            drawingContext.Close();
            image.Render(drawingVisual);
        }
开发者ID:ragnhildkarlsson,项目名称:wpf_eyepaint_mouse,代码行数:30,代码来源:View.cs


示例6: AddCircularArcGraph

		private void AddCircularArcGraph(Point startPoint, Point endPoint, Size size)
		{
			PathFigure pf = new PathFigure();
			pf.StartPoint = new Point(startPoint.X, startPoint.Y);

			ArcSegment arcSegment = new ArcSegment();
			arcSegment.Point = new Point(endPoint.X, endPoint.Y);
			arcSegment.Size = size;
			arcSegment.SweepDirection = SweepDirection.Counterclockwise;

			PathSegmentCollection psc = new PathSegmentCollection();
			psc.Add(arcSegment);

			pf.Segments = psc;

			PathFigureCollection pfc = new PathFigureCollection();
			pfc.Add(pf);

			PathGeometry pg = new PathGeometry();
			pg.Figures = pfc;

			var path = new Path();
			path.Stroke = Brushes.Black;
			path.StrokeThickness = 1;
			path.Data = pg;
			path.Fill = Brushes.Orange;
			path.Stretch = Stretch.Fill;

			var viewportPanel = new ViewportHostPanel();
			ViewportPanel.SetViewportBounds(path, new DataRect(0, 0, 50, 50));
			viewportPanel.Children.Add(path);
			plotter.Children.Add(viewportPanel);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:33,代码来源:Window1.xaml.cs


示例7: Draw

        public void Draw(EasingFunctionBase easingFunction)
        {
            canvas1.Children.Clear();


            PathSegmentCollection pathSegments = new PathSegmentCollection();

            for (double i = 0; i < 1; i += _samplingInterval)
            {
                double x = i * canvas1.Width;
                double y = easingFunction.Ease(i) * canvas1.Height;

                var segment = new LineSegment();
                segment.Point = new Point(x, y);

                pathSegments.Add(segment);

            }
            var p = new Path();
            p.Stroke = new SolidColorBrush(Colors.Black);
            p.StrokeThickness = 3;
            PathFigureCollection figures = new PathFigureCollection();
            figures.Add(new PathFigure() { Segments = pathSegments });
            p.Data = new PathGeometry() { Figures = figures };
            canvas1.Children.Add(p);
        }
开发者ID:CNinnovation,项目名称:WPFWorkshopFeb2016,代码行数:26,代码来源:EasingChartControl.xaml.cs


示例8: AddArc

        public PathFigure AddArc(int start, int end)
        {
            int horizontalPostion = 100;

            var startPoint = new Point(horizontalPostion, start);
            var endPoint = new Point(horizontalPostion, end);

            PathFigure pathFigure = new PathFigure();
            pathFigure.StartPoint = startPoint;

            ArcSegment arcSeg = new ArcSegment();
            arcSeg.Point = endPoint;
            arcSeg.Size = new Size(25, 25);
            arcSeg.IsLargeArc = true;
            arcSeg.SweepDirection = SweepDirection.Clockwise;
            arcSeg.RotationAngle = 90;

            var arrowhead = new Polygon();
            arrowhead.Stroke = Brushes.Black;
            arrowhead.StrokeThickness = 2;
            arrowhead.Points.Add(new Point(endPoint.X - 4, endPoint.Y));
            arrowhead.Points.Add(new Point(endPoint.X + 4, endPoint.Y + 3));
            arrowhead.Points.Add(new Point(endPoint.X + 4, endPoint.Y - 3));
            arrowhead.Fill = Brushes.Black;

            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            myPathSegmentCollection.Add(arcSeg);
            pathFigure.Segments = myPathSegmentCollection;

            _pathFigureCollection.Add(pathFigure);

            _root.Children.Add(arrowhead);

            return pathFigure;
        }
开发者ID:pottereric,项目名称:Synopsis,代码行数:35,代码来源:ArcAdder.cs


示例9: RenderPolygon

        private void RenderPolygon(DrawingContext drawingContext)
        {
            var fillBrush = Brushes.LawnGreen;
            var borderPen = new Pen(Brushes.Black,1.0);

            PathFigure myPathFigure = new PathFigure();
            myPathFigure.StartPoint = maxPoints[0];

            //PolyLineSegment seg = new PolyLineSegment(

            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();

            for (int i = 1; i < maxPoints.Count; i++)
            {
                myPathSegmentCollection.Add(new LineSegment(maxPoints[i], true));
            }
            for (int i = minPoints.Count - 1; i >= 0; i--)
            {
                myPathSegmentCollection.Add(new LineSegment(minPoints[i], true));
            }

            myPathFigure.Segments = myPathSegmentCollection;
            PathGeometry myPathGeometry = new PathGeometry();
            
            myPathGeometry.Figures.Add(myPathFigure);

            drawingContext.DrawGeometry(fillBrush, borderPen, myPathGeometry);
        }
开发者ID:ActivePHOENiX,项目名称:NAudio,代码行数:28,代码来源:WaveformVisual.cs


示例10: Clone

 public static PathSegmentCollection Clone(this PathSegmentCollection source)
 {
     var result = new PathSegmentCollection();
     foreach (var pathSegment in source)
     {
         var line = pathSegment as LineSegment;
         result.Add(new LineSegment { Point = line.Point });
     }
     return result;
 }
开发者ID:dingxinbei,项目名称:OLdBck,代码行数:10,代码来源:UCPage.Compute.cs


示例11: Convert

 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     var ps = new PathSegmentCollection(4);
     ContentPresenter cp = (ContentPresenter)value;
     double h = cp.ActualHeight > 10 ? 1.4 * cp.ActualHeight : 10;
     double w = cp.ActualWidth > 10 ? 1.25 * cp.ActualWidth : 10;
     ps.Add(new LineSegment(new Point(1, 0.7 * h), true));
     ps.Add(new BezierSegment(new Point(1, 0.9 * h), new Point(0.1 * h, h), new Point(0.3 * h, h), true));
     ps.Add(new LineSegment(new Point(w, h), true));
     ps.Add(new BezierSegment(new Point(w + 0.6 * h, h), new Point(w + h, 0), new Point(w + h * 1.3, 0), true));
     return ps;
 }
开发者ID:step4u,项目名称:MiniCRM,代码行数:12,代码来源:ContentToPathConverter.cs


示例12: Convert

        /// <summary>
        /// Converts a value.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>A converted value. If the method returns null, the valid null value is used.</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var cp = (FrameworkElement)value;
            double h = cp.ActualHeight > 10 ? 1.4 * cp.ActualHeight : 10;
            double w = cp.ActualWidth > 10 ? 1.25 * cp.ActualWidth : 10;
            PathSegmentCollection ps = new PathSegmentCollection(4)
            {
                new LineSegment(new Point(1, 0.7 * h), true),
                new BezierSegment(new Point(1, 0.9 * h), new Point(0.1 * h, h), new Point(0.3 * h, h), true),
                new LineSegment(new Point(w, h), true),
                new BezierSegment(new Point(w + (0.6 * h), h), new Point(w + h, 0), new Point(w + (h * 1.3), 0), true)
            };

            return ps;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:23,代码来源:ContentToPathConverter.cs


示例13: GenerateBezierCurve

        public static PathGeometry GenerateBezierCurve(Point[] points)
        {
            PathFigure pathFigure = new PathFigure();
            PointCollection pointCollection = new PointCollection(points.Length);
            pathFigure.StartPoint = new Point(points[0].X, points[0].Y);

            PathGeometry myPathGeometry = new PathGeometry();
            PathSegment pathSegment;

            if (points.Length == 2)
            {
                pathSegment = new LineSegment();
                ((LineSegment)pathSegment).Point = new Point(points[1].X, points[1].Y);
            }
            else if (points.Length == 3)
            {
                pathSegment = new QuadraticBezierSegment();
                ((QuadraticBezierSegment)pathSegment).Point1 = new Point(points[1].X, points[1].Y);
                ((QuadraticBezierSegment)pathSegment).Point2 = new Point(points[2].X, points[2].Y);
            }
            else if (points.Length == 4)
            {
                for (int i = 1; i < points.Length; i++)
                {
                    pointCollection.Add(points[i]);
                }

                pathSegment = new PolyBezierSegment();
                ((PolyBezierSegment)pathSegment).Points = pointCollection;
            }
            else
            {
                return null;
            }

            PathSegmentCollection pathSegmentCollection = new PathSegmentCollection();
            pathSegmentCollection.Add(pathSegment);

            pathFigure.Segments = pathSegmentCollection;

            PathFigureCollection pathFigureCollection = new PathFigureCollection();
            pathFigureCollection.Add(pathFigure);

            myPathGeometry.Figures = pathFigureCollection;

            return myPathGeometry;
        }
开发者ID:BrettHewitt,项目名称:MWA,代码行数:47,代码来源:DrawingUtility.cs


示例14: PointOfViewIndicator

        public PointOfViewIndicator()
        {
            _activePositionBrush = Brushes.Red;
            _lineBrush = Brushes.DarkGray;
            _linePen = new Pen(_lineBrush, 1d);

            PathSegmentCollection segments = new PathSegmentCollection(4);
            segments.Add(new LineSegment(new Point(0, 10), false));
            segments.Add(new LineSegment(new Point(5, 0), false));
            segments.Add(new LineSegment(new Point(10, 10), false));
            segments.Add(new LineSegment(new Point(5, 5), false));

            PathFigureCollection figures = new PathFigureCollection();
            figures.Add(new PathFigure(new Point(5, 5), segments, true));

            _arrowPath = new PathGeometry(figures);
        }
开发者ID:Heliflyer,项目名称:helios,代码行数:17,代码来源:PointOfViewIndicator.cs


示例15: Draw

        public Path Draw(double X, double Y)
        {
            Path path = new Path();
            Canvas.SetTop(path, Y);
            Canvas.SetLeft(path, X);
            //Make Geometry
            _arcSeg = new ArcSegment(new Point(X+800, Y+800), new Size(1000, 2000), 0.0, true, SweepDirection.Clockwise, true);
            PathSegmentCollection psc = new PathSegmentCollection(){_arcSeg};
            _pathFig = new PathFigure(new Point(X, Y), psc, false);
            PathFigureCollection pfc = new PathFigureCollection(){_pathFig};
            PathGeometry pgeo = new PathGeometry(pfc);
            path.Data = pgeo;

            path.StrokeThickness = 200;
            path.Fill = Brushes.White;
            path.Stroke = Brushes.Black;

            return path;
        }
开发者ID:computmaxer,项目名称:TotalDMXControl,代码行数:19,代码来源:StepPath.cs


示例16: CreatePath

        public Path CreatePath(Point location, double angle, double radius, double innerRadius, Brush brush)
        {
            var isLargeArc = angle > FULL_ARC / 2;

            var path = new Path();
            var segments = new PathSegmentCollection();
            var arcPoint = ConvertRadianToCartesian(angle, radius);
            var innerArcPoint = ConvertRadianToCartesian(angle, innerRadius);

            segments.Add(new LineSegment(new Point(location.X, location.Y - radius), false));
            segments.Add(new ArcSegment(new Point(location.X + arcPoint.X, location.Y + arcPoint.Y), new Size(radius, radius), 0, isLargeArc, SweepDirection.Clockwise, false));
            segments.Add(new LineSegment(new Point(location.X + innerArcPoint.X, location.Y + innerArcPoint.Y), false));
            segments.Add(new ArcSegment(new Point(location.X, location.Y - innerRadius), new Size(innerRadius, innerRadius), 0, isLargeArc, SweepDirection.Counterclockwise, false));

            var figure = new PathFigure(location, segments, true);
            path.Data = new PathGeometry { Figures = new PathFigureCollection { figure } };

            path.Fill = brush;
            return path;
        }
开发者ID:an83,项目名称:KinectTouch2,代码行数:20,代码来源:PathFactory.cs


示例17: PointsAroundWidget

        private static PathSegmentCollection PointsAroundWidget(List<System.Windows.Point> pointlist)
        {
            PathSegmentCollection collection = new PathSegmentCollection();

            int index = 0;
            collection.Add(new ArcSegment(pointlist[index], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));


            index = (index + 1) % pointlist.Count;
            collection.Add(new ArcSegment(pointlist[index], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));


            index = (index + 1) % pointlist.Count;
            collection.Add(new ArcSegment(pointlist[index], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));


            index = (index + 1) % pointlist.Count;
            collection.Add(new ArcSegment(pointlist[index], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));

            return collection;
        }
开发者ID:nunb,项目名称:authoring,代码行数:21,代码来源:BubbleCursorVisualizer.cs


示例18: Convert

 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     PathSegmentCollection retVal = new PathSegmentCollection();
     PointCollection pointCollection = value as PointCollection;
     if (RoundRadius > 0)
     {
         if (pointCollection != null && pointCollection.Count > 0)
         {
             retVal.Add(new LineSegment(pointCollection[0], true));
             double curSegmentArcUsed = 0;
             for (int i = 1; i < pointCollection.Count - 1; i++)
             {
                 double dist1 = DesignerGeometryHelper.DistanceBetweenPoints(pointCollection[i - 1], pointCollection[i]);
                 double dist2 = DesignerGeometryHelper.DistanceBetweenPoints(pointCollection[i], pointCollection[i + 1]);
                 if (dist1 - curSegmentArcUsed > RoundRadius &&
                     dist2 > RoundRadius)
                 {
                     //build rounded arc at line join.
                     curSegmentArcUsed = RoundRadius;
                     Vector firstSegmentPointingVector = new Vector(pointCollection[i].X - pointCollection[i - 1].X, pointCollection[i].Y - pointCollection[i - 1].Y);
                     Vector secondSegmentPointingVector = new Vector(pointCollection[i + 1].X - pointCollection[i].X, pointCollection[i + 1].Y - pointCollection[i].Y);
                     firstSegmentPointingVector.Normalize();
                     secondSegmentPointingVector.Normalize();
                     Point turningPoint1 = Point.Add(pointCollection[i - 1], Vector.Multiply(dist1 - RoundRadius, firstSegmentPointingVector));
                     Point turningPoint2 = Point.Add(pointCollection[i], Vector.Multiply(RoundRadius, secondSegmentPointingVector));
                     double crossProductZ = firstSegmentPointingVector.X * secondSegmentPointingVector.Y - firstSegmentPointingVector.Y * secondSegmentPointingVector.X;
                     retVal.Add(new LineSegment(turningPoint1, true));
                     retVal.Add(new ArcSegment(turningPoint2, new Size(RoundRadius, RoundRadius), 0, false, crossProductZ > 0 ? SweepDirection.Clockwise : SweepDirection.Counterclockwise, true));
                 }
                 else
                 {
                     curSegmentArcUsed = 0;
                     retVal.Add(new LineSegment(pointCollection[i], true));
                 }
             }
             retVal.Add(new LineSegment(pointCollection[pointCollection.Count - 1], true));
         }
     }
     return retVal;
 }
开发者ID:blacklensama,项目名称:1709,代码行数:40,代码来源:ConnectorPointsToSegmentsConverter.cs


示例19: Arc

        public void Arc(Canvas surface, double left, double top, double right, double bottom, double startArcX, double startArcY, double endArcX, double endArcY)
        {
            var arc = new Path();
            var figure = new PathFigure();
            var segments = new PathSegmentCollection();

            var center = new Point(left + ((right - left) / 2), top + ((bottom - top) / 2));
            double degrees = Math.Atan2(startArcY - center.Y, startArcX - center.X)
                            - Math.Atan2(endArcY - center.Y, endArcX - center.X);

            degrees *= 57.2957795; // Convert from radians to degrees
            bool isLargeArc = Math.Abs(degrees) > 180;

            arc.Data = new PathGeometry();

            figure.StartPoint = new Point(LtoDX(startArcX), LtoDY(startArcY));

            var segment = new ArcSegment
                              {
                                  Point = new Point(
                                      LtoDX(endArcX),
                                      LtoDY(endArcY)),
                                  Size = new Size(
                                      (LtoDX(right) - LtoDX(left)) / 2,
                                      (LtoDY(bottom) - LtoDY(top)) / 2),
                                  RotationAngle = 0,
                                  IsLargeArc = isLargeArc,
                                  SweepDirection = SweepDirection.Counterclockwise
                              };

            segments.Add(segment);

            figure.Segments = segments;
            ((PathGeometry)arc.Data).Figures.Add(figure);

            ApplyStyle(arc, false);

            surface.Children.Add(arc);
        }
开发者ID:bbowyersmyth,项目名称:WMF2WPF,代码行数:39,代码来源:WpfGdi.cs


示例20: PointsForTractorBeam

        private static PathSegmentCollection PointsForTractorBeam(System.Windows.Point cursorLocation, List<System.Windows.Point> pointlist)
        {
            //Get the path that will be used to render the tractor beam.
            PathSegmentCollection collection = new PathSegmentCollection();

            //We will use the points that create the biggest angle for the tractor beam coming from the cursor.
            System.Windows.Point[] startAndEnd = PointsThatMakeBiggestAngle(cursorLocation, pointlist);

            //Make sure they are sorted by x value (the tractor beam is rendered clockwise).
            if (startAndEnd[0].X < startAndEnd[1].X)
            {
                System.Windows.Point tmp = startAndEnd[0];
                startAndEnd[0] = startAndEnd[1];
                startAndEnd[1] = tmp;
            }

            //Get the index of the start System.Windows.Point in the list of points around the widget and add it to the path.
            int index = pointlist.IndexOf(startAndEnd[0]);
            collection.Add(new ArcSegment(pointlist[index], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));


            //Get the index of the end System.Windows.Point in the list of points around the widget.
            int endIndex = pointlist.IndexOf(startAndEnd[1]);
            
            
            //Now add the System.Windows.Point that is closest to the cursor if it's not the starting or ending point.
            //This creates a wedge at the end of the tractor beam.
            System.Windows.Point closest = ClosestToCursor(cursorLocation, pointlist);
            if (closest != startAndEnd[0] && closest != startAndEnd[1])
                collection.Add(new ArcSegment(pointlist[pointlist.IndexOf(closest)], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));
            
            
            //Now add the end System.Windows.Point to the path.
            collection.Add(new ArcSegment(pointlist[endIndex], new System.Windows.Size(0, 0), 0, true, SweepDirection.Clockwise, false));

            
            return collection;

        }
开发者ID:nunb,项目名称:authoring,代码行数:39,代码来源:BubbleCursorVisualizer.cs



注:本文中的PathSegmentCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PathString类代码示例发布时间:2022-05-24
下一篇:
C# PathNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap