zoukankan      html  css  js  c++  java
  • Silverlight中Image控件Stretch属性的四种值比较

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

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

     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>
  • 相关阅读:
    面试话痨(四)常量在哪里呀,常量在哪里
    面试话痨(三)我会锁的四种配法,您配吗?
    面试话痨(二)C:JAVA String,别以为你穿个马甲我就不认识你了
    面试话痨(一)让我们来热切的讨论这个养猪场吧
    (JAVA)String类型的逻辑语句编译
    小白的REDIS学习(二)-链表
    小白的Redis学习(一)-SDS简单动态字符串
    mongo中的游标与数据一致性的取舍
    spring-data-mongodb与mongo shell的对应关系
    spring-data-mongodb 使用原生aggregate语句
  • 原文地址:https://www.cnblogs.com/qiernonstop/p/3725723.html
Copyright © 2011-2022 走看看