WPF 常用shape 示例

WPF 常用shape 示例

  1. Line

<Line Stroke="Black" StrokeThickness="4" X1="10" Y1="100" X2="220" Y2="40"   />

不怎好玩,我一般都用Rectangle 代替。

  1. Rectangle

最常用的,经常用Rectangle作为底背景

        <Rectangle

    Width="100"

    Height="50"

    Fill="Gainsboro"

    Stroke="YellowGreen" StrokeThickness="4"

    RadiusX="20" RadiusY="20"

    Canvas.Left="10"

    Canvas.Top="100"/>

  1. Ellipse

圆,很少用到

    <Ellipse  Width="100"  Height="50"  Stroke="Gray"  StrokeThickness="10"  Margin="20"   />

 

  1. PolyLine

折线,有几个点就写几个点。

    <Polyline Points="510,10 20,200 300,270 600,200"  Stroke="Red" Fill="AntiqueWhite"/>

 

  1. PolyGon

多边形,就是把上例的缺口补上而已。

        <Polygon Points="510,10 20,200 300,270 600,200"  Stroke="Red" Fill="AntiqueWhite"/>

原文地址:https://www.cnblogs.com/xiaokang088/p/2032865.html