形状绘图:
- 形状(Shape)是一个2D绘图类
- 位于System.Windows.Shape空间内
- 常用绘图对象:Line直线,Rectangle矩形,Ellipse椭圆,Polygon多边形,Path路径
- 图形对象共有属性:
Stroke:绘制图形轮廓的画刷
StrokeThickness:图形轮廓的画笔粗细
Fill:图形填充颜色
- Line直线:
<Line X1="200" Y1="200" X2="300" Y2="200" Stroke="Red" StrokeThickness="30" StrokeStartLineCap="Flat" StrokeEndLineCap="Triangle"></Line>
2. Rectangle矩形:
<Rectangle Width="100" Height="100" Fill="Gray" Stroke="Black" StrokeThickness="3"></Rectangle>
绘制圆角矩形:
<Rectangle Width="100" Height="100" Fill="Gray" Stroke="Black" StrokeThickness="3" RadiusX="30" RadiusY="30"></Rectangle>
- Ellipse椭圆:
<Ellipse Height="100" Width="200" Fill="Gray" Stroke="Black" StrokeThickness="3"></Ellipse>
4. Polygon多边形:
<Polygon Points="300,200 400,125 400,275" Stroke="Black" Fill="Gray" StrokeThickness="2"></Polygon>