码迷,mamicode.com
首页 > Web开发 > 详细

Silverlight中Image控件Stretch属性的四种值比较

时间:2014-05-14 07:38:24      阅读:370      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   c   

通过设置Image控件Stretch属性的值可以控制图片的显示形式:

  包含的值:None、Fill、Uniform、UniformToFill

bubuko.com,布布扣
 1  <Grid x:Name="LayoutRoot" Background="White" Height="489" Width="603">
 2         <Image Height="150" HorizontalAlignment="Left" Name="image1" Stretch="None" VerticalAlignment="Top" Width="200" Source="/SilverlightApplication1;component/Images/2009011911345229.jpg" Margin="10,14,0,0" />
 3         <Image Height="150" HorizontalAlignment="Left" Margin="325,14,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="200" Source="/SilverlightApplication1;component/Images/2009011911345229.jpg" Grid.ColumnSpan="3" />
 4         <Image Height="150" HorizontalAlignment="Left" Margin="10,239,0,0" Name="image3" Stretch="Uniform" VerticalAlignment="Top" Width="200" Source="/SilverlightApplication1;component/Images/2009011911345229.jpg"  />
 5         <Image Height="150" HorizontalAlignment="Left" Margin="325,239,0,0" Name="image4" Stretch="UniformToFill" VerticalAlignment="Top" Width="200"  Source="/SilverlightApplication1;component/Images/2009011911345229.jpg" Grid.ColumnSpan="3" />
 6         <TextBlock Height="67" HorizontalAlignment="Left" Margin="12,166,0,0" Name="textBlock1" VerticalAlignment="Top" Width="207" TextWrapping="Wrap">
 7             <TextBlock.Text>
 8                 None:图片直接加载到Image控件中,不进行拉伸,如果Image控件的大小是100X100 而图片的大小为1000X1000 则只显示顶部的100X100
 9             </TextBlock.Text>
10         </TextBlock>
11         <TextBlock Height="67" HorizontalAlignment="Left" Margin="325,166,0,0" Name="textBlock2" VerticalAlignment="Top" Width="200" TextWrapping="Wrap" Grid.ColumnSpan="3">
12             <TextBlock.Text>
13                 Fill:图片会拉伸或缩小以适应Image控件 长宽比可能改变
14             </TextBlock.Text>
15         </TextBlock>
16         <TextBlock Height="67" HorizontalAlignment="Left" Margin="12,395,0,0" Name="textBlock3"  TextWrapping="Wrap" VerticalAlignment="Top" Width="200" >
17             <TextBlock.Text>
18                 Uniform:图片会拉伸到最佳大小(不一定充满整个Image控件)保持长宽比不变
19             </TextBlock.Text>
20         </TextBlock>
21         <TextBlock Height="67" HorizontalAlignment="Left" Margin="325,395,0,0" Name="textBlock4" VerticalAlignment="Top" Width="200"  TextWrapping="Wrap" Grid.ColumnSpan="3">
22             UniformToFill:图片会在不改变长宽比的前提下拉伸,它会充满整个Image控件 但可能被裁减
23         </TextBlock>
24     </Grid>
bubuko.com,布布扣

 

 

Silverlight中Image控件Stretch属性的四种值比较,布布扣,bubuko.com

Silverlight中Image控件Stretch属性的四种值比较

标签:style   blog   class   code   java   c   

原文地址:http://www.cnblogs.com/qiernonstop/p/3725723.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!