Windows Phone开发(33):路径之其它Geometry
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Windows Phone开发(33):路径之其它Geometry,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3764字,纯文字阅读大概需要6分钟。
内容图文
原文:Windows Phone开发(33):路径之其它Geometry上一节中,我们把最复杂的PathGeometry给干了,生剩下几个家伙就好办事了。一起来见见他们的真面目吧。
一、LineGeometry
这个几何图形就很简单了,一条线段,两个点——StartPoint And EndPoint。
一起来看看下面的例子。
<Path Grid.Column="0" Grid.Row="0"> <Path.Data> <LineGeometry StartPoint="20,5" EndPoint="200,320"/> </Path.Data> </Path>
运行之后你会看到以下情景:
二、RectangleGeometry
它呈现一人矩形的几何图形,Rect指示其中矩形的位置大小,在XAML中可以用4个数值表示,即X、Y、Width、Height;别外,RadiusX和RadiusY表示圆角在X轴和Y轴上的半径。看下面的例子。
<Path Grid.Column="1" Grid.Row="0"> <Path.Data> <RectangleGeometry Rect="12,6,125,90" RadiusX="24" RadiusY="30"/> </Path.Data> </Path>
运行效果如下图所示。
三、EllipseGeometry
表示一个椭圆的几何图形,Center属性为椭圆的中心点的坐标,RadiusX和RadiusY分别为X轴方向上和Y轴方向上的半径长度。看例子。
<Path Grid.Column="0" Grid.Row="1"> <Path.Data> <EllipseGeometry Center="100,180" RadiusX="55" RadiusY="120"/> </Path.Data> </Path>
运行效果如下:
四、GeometryGroup
严格上说,它不属性一种几何图形,但它很有用,因为它可以同时包含N个几何图形,如下面例子所示。
<Path Grid.Column="1" Grid.Row="1"> <Path.Data> <GeometryGroup> <LineGeometry StartPoint="32,185" EndPoint="180,230"/> <RectangleGeometry Rect="35,85,136,96" RadiusX="25" RadiusY="5"/> <EllipseGeometry Center="112,130" RadiusX="45" RadiusY="36"/> </GeometryGroup> </Path.Data> </Path>
运行效是如下所示:
下面是本节示例的完整XAML代码。
<phone:PhoneApplicationPage x:Class="Sample.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"> <phone:PhoneApplicationPage.Resources> <Style TargetType="Path"> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="Margin" Value="20"/> <Setter Property="Stroke" Value="Blue"/> <Setter Property="StrokeThickness" Value="8"/> </Style> </phone:PhoneApplicationPage.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Path Grid.Column="0" Grid.Row="0"> <Path.Data> <LineGeometry StartPoint="20,5" EndPoint="200,320"/> </Path.Data> </Path> <Path Grid.Column="1" Grid.Row="0"> <Path.Data> <RectangleGeometry Rect="12,6,125,90" RadiusX="24" RadiusY="30"/> </Path.Data> </Path> <Path Grid.Column="0" Grid.Row="1"> <Path.Data> <EllipseGeometry Center="100,180" RadiusX="55" RadiusY="120"/> </Path.Data> </Path> <Path Grid.Column="1" Grid.Row="1"> <Path.Data> <GeometryGroup> <LineGeometry StartPoint="32,185" EndPoint="180,230"/> <RectangleGeometry Rect="35,85,136,96" RadiusX="25" RadiusY="5"/> <EllipseGeometry Center="112,130" RadiusX="45" RadiusY="36"/> </GeometryGroup> </Path.Data> </Path> </Grid> </phone:PhoneApplicationPage>
原文:http://www.cnblogs.com/lonelyxmas/p/3582677.html
内容总结
以上是互联网集市为您收集整理的Windows Phone开发(33):路径之其它Geometry全部内容,希望文章能够帮你解决Windows Phone开发(33):路径之其它Geometry所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。