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


C# PathFigure.SetValue方法代码示例

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


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

示例1: SurfaceWindow1

        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();
            Path myShape = new Path();
            myShape.StrokeThickness = 3.0;
            myShape.Fill = System.Windows.Media.Brushes.Wheat;
            myShape.Stroke = System.Windows.Media.Brushes.BlueViolet;
            PathGeometry myGeometry = new PathGeometry();
            PathFigure figure = new PathFigure();

            //Figure draws the segments upside down (this the coordinate system in negatives to draw objects)
            Double width = 200;
            Double height = 100;
            figure.SetValue(PathFigure.StartPointProperty, new Point(height, 0));
            ArcSegment arc = new ArcSegment(new Point(height, height), new Size(height / 2, height / 2), 0.0, true, SweepDirection.Counterclockwise, true);
            //Note: LineSegments take end point as the constructor, Their Start point will be the end point of previous segment(the order you added into path figure(Source API))
            LineSegment arcVertical1 = new LineSegment(new Point(height, height - 25), true);
            LineSegment horizontal1 = new LineSegment(new Point(height + 275, height - 25), true);
            LineSegment vertical = new LineSegment(new Point(height + 275, 25), true);
            LineSegment horizontal2 = new LineSegment(new Point(height, 25), true);
            LineSegment arcVertical2 = new LineSegment(new Point(height, 0), true);

            figure.Segments.Add(arc);
            figure.Segments.Add(arcVertical1);
            figure.Segments.Add(horizontal1);
            figure.Segments.Add(vertical);
            figure.Segments.Add(horizontal2);
            figure.Segments.Add(arcVertical2);
            myGeometry.Figures.Add(figure);

            myShape.Data = myGeometry;
            myCanvas.Children.Add(myShape);

            //****************************** Register for Stroke change events*************************
            // This is how we can get the currently being drawn stroke information
            inkCanvas.Strokes.StrokesChanged += new StrokeCollectionChangedEventHandler(canvasStrokesChanged);

            // Add handlers for window availability events
            AddWindowAvailabilityHandlers();
        }
开发者ID:srkapil,项目名称:Random-Projects,代码行数:43,代码来源:SurfaceWindow1.xaml.cs


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