当前位置: 首页>>代码示例>>C#>>正文


C# PathGeometry.ToString方法代码示例

本文整理汇总了C#中System.Windows.Media.PathGeometry.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PathGeometry.ToString方法的具体用法?C# PathGeometry.ToString怎么用?C# PathGeometry.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.PathGeometry的用法示例。


在下文中一共展示了PathGeometry.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAllToTogether

        public string GetAllToTogether(string[] paths)
        {
            PathGeometry result = new PathGeometry();
            foreach (var item in paths)
            {
                result.AddGeometry (  PathGeometry.Parse(item));

            }

            return result.ToString();
        }
开发者ID:waynebaby,项目名称:Code-For-Fun,代码行数:11,代码来源:TextToPathService.cs

示例2: CreateAutoShape

        private void CreateAutoShape(object sender, RoutedEventArgs e)
        {
            PathGeometry sendingPath = new PathGeometry(); 
            PathFigure pathFigure = new PathFigure();
            pathFigure.StartPoint = new Point(47.7778, 48.6667);
            pathFigure.IsClosed = true;
            LineSegment lineSegment1 = new LineSegment();
            lineSegment1.Point = new Point(198, 48.6667);
            pathFigure.Segments.Add(lineSegment1);
            LineSegment lineSegment2 = new LineSegment();
            lineSegment2.Point = new Point(198, 102);
            pathFigure.Segments.Add(lineSegment2);
            BezierSegment bezierSegment1 = new BezierSegment();
            bezierSegment1.Point1 = new Point(174.889, 91.3334);
            bezierSegment1.Point2 = new Point(157.111, 79.7778);
            bezierSegment1.Point3 = new Point(110.889, 114.444);
            pathFigure.Segments.Add(bezierSegment1);
            BezierSegment bezierSegment2 = new BezierSegment();
            bezierSegment2.Point1 = new Point(64.667, 149.111);
            bezierSegment2.Point2 = new Point(58.4444, 130.444);
            bezierSegment2.Point3 = new Point(47.7778, 118.889);
            pathFigure.Segments.Add(bezierSegment2);
            sendingPath.Figures.Add(pathFigure);

            PathGeometry pathGeometry = new PathGeometry();
            if (sendingPath.FillRule != null)
                pathGeometry.FillRule = sendingPath.FillRule;
            else pathGeometry.FillRule = FillRule.Nonzero;
            pathGeometry.Figures = sendingPath.Figures;

            var newThumb = new SandRibbonInterop.AutoShape();
            var safePathGeometry = (Geometry)(new GeometryConverter().ConvertFromString(pathGeometry.ToString()));
            var safePathData = new PathGeometry();
            safePathData.AddGeometry(safePathGeometry);
            newThumb.PathData = safePathData;
            newThumb.Background = Brushes.LightGreen;
            newThumb.Foreground = Brushes.Green;
            newThumb.StrokeThickness = 5;
            newThumb.Height = 100;
            newThumb.Width = 100;
            
            Commands.AddAutoShape.Execute(newThumb);
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:43,代码来源:SimpleToolBox.xaml.cs

示例3: PointsToPath

		/// <summary>
		///     Преобразует набор точек в путь
		/// </summary>
		/// <param name="points">Коллекция точек</param>
		/// <param name="pathKind">Тип пути - Линия(замкнутая/открытая), либо Эллипс</param>
		/// <returns></returns>
		public static string PointsToPath(PointCollection points, PathKind pathKind) {
			var enumerable = points.ToArray();
			if (!enumerable.Any()) {
				return string.Empty;
			}

			switch (pathKind) {
				case PathKind.Ellipse: {
						var radiusX = (enumerable[1].X - enumerable[0].X) / 2;
						var radiusY = (enumerable[2].Y - enumerable[1].Y) / 2;
						var center = new Point(enumerable[1].X - radiusX, enumerable[2].Y - radiusY);
						var geometry = new EllipseGeometry(center: center, radiusX: radiusX, radiusY: radiusY);
						return geometry.GetFlattenedPathGeometry().ToString(CultureInfo.InvariantCulture);
					}
				default: {
						var start = enumerable[0];
						var segments = new List<LineSegment>();
						for (var i = 1; i < enumerable.Length; i++) {
							segments.Add(new LineSegment(new Point(enumerable[i].X, enumerable[i].Y), true));
						}
						var figure = new PathFigure(start, segments, (pathKind == PathKind.ClosedLine));
						var geometry = new PathGeometry();
						geometry.Figures.Add(figure);
						return geometry.ToString(CultureInfo.InvariantCulture);
					}
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:33,代码来源:InternalConverter.cs


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