技术开发 频道

Windows Phone 7 学习之画图

  上面三个实现的Path 效果分别为下图:

Windows Phone 7 学习之画图(四)

  3.Ellipse 圆形或椭圆形

  Ellipse 使用起来就比较简单,只要注意设置它的高和宽之间的大小,实现代码如下:

  < Ellipse Height="100" HorizontalAlignment="Left" Margin="111,32,0,0" Name="ellipse1" Stroke="Red" StrokeThickness="1" VerticalAlignment="Top" Width="200" />

  < Ellipse Height="100" HorizontalAlignment="Left" Margin="161,223,0,0" Name="ellipse2" Stroke="Red" StrokeThickness="1" VerticalAlignment="Top" Width="100" />

  实现效果:

Windows Phone 7 学习之画图(四)

  4.Rectangle 矩形,方块矩形或圆角矩形

  跟上面的Ellipse 实现也同样方便,注意设置它的RadiusX 和 RadiusY ,代码如下:

  < Rectangle Height="100" HorizontalAlignment="Left" Margin="133,48,0,0" Name="rectangle1" Stroke="Red" StrokeThickness="1" VerticalAlignment="Top" Width="200" />

  < Rectangle Height="100" RadiusX="50" RadiusY="50" HorizontalAlignment="Left" Margin="133,274,0,0" Name="rectangle2" Stroke="Red" StrokeThickness="1" VerticalAlignment="Top" Width="200" />

  实现效果如下图:

Windows Phone 7 学习之画图(四)

  5.Line 直线

  直线需要注意的是它有四个坐标要设置,即X1 Y1 X2 Y2,x代表直线起始点和结束点的相对自己的位置,相同则成垂直,如果不相等则倾斜或者横放,Y 代表两点之间的长度,以Y1为起点画到Y2为结束点,实例代码如下:

  < Line Height="10" X1="10" Y1="10" X2="350" Y2="10" HorizontalAlignment="Left" Margin="52,63,0,0" Name="line1" Stroke="Red" StrokeThickness="5" VerticalAlignment="Top" Width="360" />

  < Line Height="314" HorizontalAlignment="Left" Margin="56,124,0,0" Name="line2" Stroke="Yellow" StrokeThickness="5" VerticalAlignment="Top"

0
相关文章