使用XAML做出的各种2D图形
开发工具与关键技术:Visual Studio + WPF + SQL Server + .Net
作者:琉敏
撰写时间:2019年5月3日
1、 直线图。首先定义两点(X1,Y1)和(X2,Y2),两点连成一条直线,属性Stroke是改变直线的颜色,属性StrokeThickness是改变直线的粗细程度。
<Window x:Class="_2DShape.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="直线" Height="180" Width="350">
<Line X1="300" Y1="100" X2="100" Y2="100" Stroke="Blue" StrokeThickness="8"></Line>
</Window>
1)界面运行效果:
2、 修改直线形状。属性StrokeStartLineCap是改变直线开始的形状,属性StrokeEndLineCap是改变直线结尾的形状,这两个属性都有四个值(Flat:不变,保持原型;Round:变成圆形;Square:变成方形;Triangle:变成三角形)可改变直线的开始和结尾的形状。
<Window x:Class="_2DShape.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="直线" Height="180" Width=