WPF Path

时间:2016-09-03 06:20:46   收藏:0   阅读:345

在WPF中,自定义控件,经常用到Path.

Path可以绘制多边形、边框、线条、简单的图标等。

1、Xaml中用法:

<Path Stroke="DodgerBlue" StrokeThickness="1" Data="M50,50 L100,200 L200,50 L50,50"></Path>

技术分享

2、后台中用法:

        Path path=new Path();
        path.Stroke = Brushes.DodgerBlue;
        path.StrokeThickness = 1;
        var aaa = new PathSegmentCollection();
        aaa.Add(new LineSegment(new Point(200,20),true));
        path.Data=new PathGeometry()
        {
            Figures = new PathFigureCollection()
            {
                new PathFigure()
                {
                    IsClosed = true,
                    StartPoint = new Point(10,10),
                    Segments = aaa
                }
            }
        };

技术分享

 

原文:http://www.cnblogs.com/kybs0/p/5789452.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!