自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Windows Phone開發(fā)(33):路徑之其它Geometry

移動(dòng)開發(fā)
Windows Phone具有桌面定制、圖標(biāo)拖拽、滑動(dòng)控制等一系列前衛(wèi)的操作體驗(yàn)。其主屏幕通過提供類似儀表盤的體驗(yàn)來顯示新的電子郵件、短信、未接來電、日歷約會(huì)等,讓人們對(duì)重要信息保持時(shí)刻更新。

上一節(jié)中,我們把最復(fù)雜的PathGeometry給干了,生剩下幾個(gè)家伙就好辦事了。一起來見見他們的真面目吧。

一、LineGeometry

這個(gè)幾何圖形就很簡(jiǎn)單了,一條線段,兩個(gè)點(diǎn)——StartPoint And EndPoint。

一起來看看下面的例子。

  1. <Path Grid.Column="0" Grid.Row="0">   
  2.     <Path.Data>   
  3.         <LineGeometry StartPoint="20,5" EndPoint="200,320"/>   
  4.     </Path.Data>   
  5. </Path>   

運(yùn)行之后你會(huì)看到以下情景:

二、RectangleGeometry

它呈現(xiàn)一人矩形的幾何圖形,Rect指示其中矩形的位置大小,在XAML中可以用4個(gè)數(shù)值表示,即X、Y、Width、Height;別外,RadiusX和RadiusY表示圓角在X軸和Y軸上的半徑。看下面的例子。

  1. <Path Grid.Column="1" Grid.Row="0">   
  2.     <Path.Data>   
  3.         <RectangleGeometry Rect="12,6,125,90" RadiusX="24" RadiusY="30"/>   
  4.     </Path.Data>   
  5. </Path>   

運(yùn)行效果如下圖所示。

三、EllipseGeometry

表示一個(gè)橢圓的幾何圖形,Center屬性為橢圓的中心點(diǎn)的坐標(biāo),RadiusX和RadiusY分別為X軸方向上和Y軸方向上的半徑長(zhǎng)度??蠢?。

  1. <Path Grid.Column="0" Grid.Row="1">   
  2.     <Path.Data>   
  3.         <EllipseGeometry Center="100,180" RadiusX="55" RadiusY="120"/>   
  4.     </Path.Data>   
  5. </Path> 

運(yùn)行效果如下:

四、GeometryGroup

嚴(yán)格上說,它不屬性一種幾何圖形,但它很有用,因?yàn)樗梢酝瑫r(shí)包含N個(gè)幾何圖形,如下面例子所示。

  1. <Path Grid.Column="1" Grid.Row="1">   
  2.     <Path.Data>   
  3.         <GeometryGroup>   
  4.             <LineGeometry StartPoint="32,185" EndPoint="180,230"/>   
  5.             <RectangleGeometry Rect="35,85,136,96" RadiusX="25" RadiusY="5"/>   
  6.             <EllipseGeometry Center="112,130" RadiusX="45" RadiusY="36"/>   
  7.         </GeometryGroup>   
  8.     </Path.Data>   
  9. </Path>   

運(yùn)行效是如下所示:

下面是本節(jié)示例的完整XAML代碼。

  1. <phone:PhoneApplicationPage    
  2.     x:Class="Sample.MainPage"   
  3.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
  4.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
  5.     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"   
  6.     xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"   
  7.     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
  8.     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
  9.     mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"   
  10.     FontFamily="{StaticResource PhoneFontFamilyNormal}"   
  11.     FontSize="{StaticResource PhoneFontSizeNormal}"   
  12.     Foreground="{StaticResource PhoneForegroundBrush}"   
  13.     SupportedOrientations="Portrait" Orientation="Portrait"   
  14.     shell:SystemTray.IsVisible="True">   
  15.    
  16.     <phone:PhoneApplicationPage.Resources>   
  17.         <Style TargetType="Path">   
  18.             <Setter Property="HorizontalAlignment" Value="Stretch"/>   
  19.             <Setter Property="VerticalAlignment" Value="Stretch"/>   
  20.             <Setter Property="Margin" Value="20"/>   
  21.             <Setter Property="Stroke" Value="Blue"/>   
  22.             <Setter Property="StrokeThickness" Value="8"/>   
  23.         </Style>   
  24.     </phone:PhoneApplicationPage.Resources>   
  25.        
  26.     <Grid>   
  27.         <Grid.ColumnDefinitions>   
  28.             <ColumnDefinition Width="*"/>   
  29.             <ColumnDefinition Width="*"/>   
  30.         </Grid.ColumnDefinitions>   
  31.         <Grid.RowDefinitions>   
  32.             <RowDefinition Height="*"/>   
  33.             <RowDefinition Height="*"/>   
  34.         </Grid.RowDefinitions>   
  35.         <Path Grid.Column="0" Grid.Row="0">   
  36.             <Path.Data>   
  37.                 <LineGeometry StartPoint="20,5" EndPoint="200,320"/>   
  38.             </Path.Data>   
  39.         </Path>   
  40.         <Path Grid.Column="1" Grid.Row="0">   
  41.             <Path.Data>   
  42.                 <RectangleGeometry Rect="12,6,125,90" RadiusX="24" RadiusY="30"/>   
  43.             </Path.Data>   
  44.         </Path>   
  45.         <Path Grid.Column="0" Grid.Row="1">   
  46.             <Path.Data>   
  47.                 <EllipseGeometry Center="100,180" RadiusX="55" RadiusY="120"/>   
  48.             </Path.Data>   
  49.         </Path>   
  50.         <Path Grid.Column="1" Grid.Row="1">   
  51.             <Path.Data>   
  52.                 <GeometryGroup>   
  53.                     <LineGeometry StartPoint="32,185" EndPoint="180,230"/>   
  54.                     <RectangleGeometry Rect="35,85,136,96" RadiusX="25" RadiusY="5"/>   
  55.                     <EllipseGeometry Center="112,130" RadiusX="45" RadiusY="36"/>   
  56.                 </GeometryGroup>   
  57.             </Path.Data>   
  58.         </Path>   
  59.     </Grid>   
  60. </phone:PhoneApplicationPage>   

 

責(zé)任編輯:閆佳明 來源: oschina
相關(guān)推薦

2013-04-19 17:11:02

Windows PhoWindows Pho

2013-04-23 16:59:22

Windows Pho路徑標(biāo)記語法

2013-07-31 13:13:50

Windows PhoMVVM模式

2013-04-24 13:43:10

Windows Pho動(dòng)畫PointAnim

2013-04-24 13:19:06

Windows Pho動(dòng)畫DoubleAni

2013-04-24 13:31:59

Windows Pho動(dòng)畫之ColorAni

2013-07-31 13:36:07

Windows PhoVS調(diào)試技巧Windows Pho

2010-04-21 17:07:54

Windows Pho

2013-07-30 12:37:56

Windows PhoWindows Pho

2010-08-06 15:44:28

Windows PhoWindows PhoSilverlight

2013-04-16 17:02:50

Windows Pho概論

2013-04-19 16:34:56

Windows PhoWindows Pho

2013-07-30 11:18:37

Windows PhoWindows Pho

2011-06-07 12:42:15

Windows Pho

2013-04-17 14:00:06

Windows PhoWindows Pho

2010-04-08 17:40:23

Windows Pho

2013-04-25 15:15:41

Windows PhoWindows PhoWindows Pho

2010-12-14 18:48:49

微軟

2012-06-04 14:47:58

Windows Pho

2013-04-19 15:35:54

Windows Pho隔離存儲(chǔ)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)