WPF使用Path画线、矩形和圆和三角形


 

<Window x:Class="WPF中通过Path画形状.Window1"
    xmlns=" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Canvas>
        <Line Stroke="Blue" StrokeThickness="5" X1="10" Y1="10" X2="100" Y2="10"/>
        <Path Stroke="Blue" StrokeThickness="5">
            <Path.Data>
                <LineGeometry StartPoint="10,20" EndPoint="100,20"/>
            </Path.Data>
        </Path>
        <Rectangle Stroke="Blue" Width="30" Height="20" Canvas.Top="30" Canvas.Left="10"/>
        <Path Stroke="Blue">
            <Path.Data>
               <RectangleGeometry Rect="50,30,30,20"/>
            </Path.Data>
        </Path>
        <Ellipse Stroke="Blue" Fill="DarkSlateGray" Width="20" Height="20" Canvas.Top="60" Canvas.Left="10"/>
        <Path Stroke="Blue" Fill="AntiqueWhite">
            <Path.Data>
                <EllipseGeometry RadiusX="10" RadiusY="10" Center="60,70"/>
            </Path.Data>
        </Path>

<Path Stroke="Black" StrokeThickness="0" Fill="Blue" Canvas.Top="90" Canvas.Left="10">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="15,0" IsClosed="True">
<LineSegment Point="0,15" />
<LineSegment Point="30,15" />
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>


    </Canvas>
</Window>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM