基本图形:
Rectangle及Ellipse
此示例为了测试RadiusX,RadiusY这两个属性的具体含义
<UserControl x:Class="ShapeDemo.MainPage"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<Rectangle RadiusX="25" RadiusY="5" Width="100" Height="100" Stroke="Red" StrokeThickness="1" ToolTipService.ToolTip="红色长方形=宽:100 高:100 圆角X轴半径:25 圆角Y轴半径:5"></Rectangle>
<Ellipse Width="50" Height="50" Stroke="Green" StrokeThickness="1" Margin="-50,-150,0,0" ToolTipService.ToolTip="绿色圆形=宽:50 高:50 "></Ellipse>
<Ellipse Width="50" Height="10" Stroke="Black" StrokeThickness="1" Margin="-50,-190,0,0" ToolTipService.ToolTip="黑色椭圆形=宽:50 高:10 "></Ellipse>
<Rectangle RadiusX="25" RadiusY="25" Width="100" Height="100" Stroke="Purple" StrokeThickness="1" ToolTipService.ToolTip="紫色长方形=宽:100 高:100 圆角X轴半径:25 圆角Y轴半径:25"></Rectangle>
<Ellipse Width="50" Height="50" Stroke="Blue" StrokeThickness="1" Margin="-50,-150,0,0" ToolTipService.ToolTip="蓝色圆形=宽:50 高:50 "></Ellipse>
<Ellipse Width="50" Height="10" Stroke="Yellow" StrokeThickness="1" Margin="-50,-190,0,0" ToolTipService.ToolTip="黄色椭圆形=宽:50 高:10 "></Ellipse>
</StackPanel>
</Grid>
</UserControl>
测试结果如图:
浙公网安备 33010602011771号