WPF Path Geometry PathFigureCollection PathFigure PathFigure.Segments PolyQuadraticBezierSegment

<Window x:Class="WpfApp118.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp118"
        mc:Ignorable="d" WindowState="Maximized"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Path Stroke="Black" StrokeThickness="10">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigure IsClosed="True" StartPoint="10,100">
                            <LineSegment Point="100,100"/>
                            <LineSegment Point="100,50"/> 
                        </PathFigure>
                        <PathFigure IsClosed="True" StartPoint="100,200">
                            <LineSegment Point="100,300"/>
                            <LineSegment Point="200,300"/>
                        </PathFigure>
                        <PathFigure StartPoint="800,800">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <ArcSegment Size="30,30" RotationAngle="25" IsLargeArc="False"
                                                SweepDirection="Counterclockwise"/>
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                    </PathGeometry.Figures> 
                </PathGeometry> 
            </Path.Data>
        </Path>
        <Path Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="900,1200">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <ArcSegment Size="100,50" RotationAngle="45" IsLargeArc="True" 
                                                    SweepDirection="CounterClockwise" Point="200,100" />
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
        <Path Stroke="Red" StrokeThickness="5">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="10,100">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <BezierSegment Point1="100,0"
                                                       Point2="200,200"
                                                       Point3="300,100"/>
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
        <Path Stroke="Green" StrokeThickness="5">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="700,700">
                                <PathFigure.Segments>
                                    <QuadraticBezierSegment Point1="1200,1200"
                                                            Point2="1300,700"/>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
        <Path Stroke="Yellow" StrokeThickness="5">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="900,1200">
                                <PathFigure.Segments>
                                    <PolyQuadraticBezierSegment  Points="200,200 300,100 0,200 30,400" />
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
    </Grid>
</Window>

 

posted @ 2024-05-28 22:57  FredGrit  阅读(6)  评论(0编辑  收藏  举报