说到绘图,大家是不是想到了美术呢?那讲到绘图各位肯定会想到绘图需要一定的美术功底呢。其实这里讲的不是美术的绘图哈,这里讲的是使用编程语言去绘图。当然这个也时需要编程语言基础的是吧!
这里的几何绘图其实也不是很难的,只要你能够想到的那么你就一定能够写的出来,这个说简单也不简单说不难也难。
这次要分享给大家的图形是:
- 直线
- 矩形
- 椭圆
- 多边形
- 多线形
那么这次我就给大家分享下几何绘图哈?
下面请看代:
<Window x:Class="绘图_形状绘图和几何绘图_.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:绘图_形状绘图和几何绘图_"
mc:Ignorable="d"
Title="MainWindow" Height="768" Width="1355">
<!--栈式面板布局-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<!--形状绘图-->
<StackPanel Grid.Row="0" Orientation="Horizontal">
<!--Line直线-->
<Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Red" StrokeThickness="20"
StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle"/>
<!--Rectangle矩形-->
<Rectangle Stroke="Red" StrokeThickness="20" Width="100" StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle" Fill="Blue" RadiusX="30" RadiusY="30"/>
<!--Ellipse椭圆-->
<Ellipse StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle" Stroke="Red" StrokeThickness="20" Width="100" Fill="Yellow"/>
<!--Polygon多边形-->
<Polygon Points="200,200 100,200 300,150 200 150" Stroke="Red" StrokeThickness="10" Fill="Aqua"/>
<!--Polyline多线形-->
<Polyline Points="200,200 100,200 300,150" Stroke="Red" StrokeThickness="10" Fill="Gray"/>
</StackPanel>
<!--几何绘图-->
<StackPanel Orientation="Horizontal">
<Path>
</Path>
</StackPanel>
</Grid>
</Window>
效果图如下:
总结:
今天的代码就分享到这里了,以上代码如果有错或者哪里写的不够好的话还请各位大神多多指点下哈。