BezierSegment
//Bezier Curve using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApp170 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); PathFigureDemo(); } private void PathFigureDemo() { PathFigure pfi = new PathFigure(); pfi.StartPoint = new Point(100, 150); pfi.Segments.Add( new BezierSegment( new Point(100, 0), new Point(500, 500), new Point(800, 200), true)); PathGeometry pathGeo = new PathGeometry(); pathGeo.Figures.Add(pfi); Path ph = new Path(); ph.Stroke = new SolidColorBrush(Colors.Red); ph.StrokeThickness = 5; ph.Data = pathGeo; this.Content= ph; } } }
LineSegment
public MainWindow() { InitializeComponent(); LineSegmentFigureDemo(); } void LineSegmentFigureDemo() { PathFigure pfi = new PathFigure(); pfi.StartPoint = new Point(0, 0); pfi.Segments.Add( new LineSegment(new Point(1600, 900), true)); PathGeometry pathGeo = new PathGeometry(); pathGeo.Figures.Add(pfi); Path ph = new Path(); ph.Stroke = new SolidColorBrush(Colors.Red); ph.StrokeThickness = 20; ph.Data = pathGeo; this.Content = ph; }
ArcSegment
public MainWindow() { InitializeComponent(); ArcSegmentFigureDemo(); } void ArcSegmentFigureDemo() { PathFigure pfi = new PathFigure(); pfi.StartPoint = new Point(200, 200); pfi.Segments.Add( new ArcSegment(new Point(800, 800), new Size(300, 300), 50, true, SweepDirection.Clockwise, true)); PathGeometry pathGeo = new PathGeometry(); pathGeo.Figures.Add(pfi); Path ph = new Path(); ph.Stroke = new SolidColorBrush(Colors.Red); ph.StrokeThickness = 20; ph.Fill = new SolidColorBrush(Colors.Cyan); ph.Data = pathGeo; this.Content = ph; }
Mixed LineSegment,BezierSegment,ArcSegment
public MainWindow() { InitializeComponent(); MixedLineBezierArcSegmentDemo(); } void MixedLineBezierArcSegmentDemo() { PathFigure pfi = new PathFigure(); pfi.StartPoint = new Point(0, 0); pfi.Segments.Add(new LineSegment(new Point(1600, 900), true)); pfi.Segments.Add(new ArcSegment(new Point(800, 800), new Size(300, 300), 50, true, SweepDirection.Clockwise,true)); pfi.Segments.Add(new BezierSegment( new Point(100, 0), new Point(500, 500), new Point(800, 200), true)); PathGeometry pathGeo = new PathGeometry(); pathGeo.Figures.Add(pfi); Path ph = new Path(); ph.Stroke = new SolidColorBrush(Colors.Red); ph.StrokeThickness = 20; ph.Fill = new SolidColorBrush(Colors.Cyan); ph.Data = pathGeo; this.Content = ph; }
标签:ArcSegment,BezierSegment,PathFigure,pfi,Point,System,using,new,ph From: https://www.cnblogs.com/Fred1987/p/18249755