Stretch屬性


Cited from Microsoft Help:

The Stretch property accepts the following values, which the Stretch enumeration defines:

  • None: The TileBrush content does not stretch to fill the tile.

  • Uniform: The TileBrush content is scaled to fit the tile dimensions. However, the aspect ratio of the content is preserved.

  • UniformToFill: The TileBrush content is scaled so that it completely fills the output area but preserves its original aspect ratio.

  • Fill: The TileBrush content is scaled to fit the tile. Because the content's height and width are scaled independently, the original aspect ratio of the content might not be preserved. That is, the TileBrush content might be distorted in order to completely fill the output tile.

The following image illustrates the different Stretch settings.

By default, an ImageBrush stretches its image to completely fill the area that you are painting. (即Stretch屬性的默認值為“Fill”)

 

自解:

Stretch屬性類似於電腦桌面背景的設置,具有該屬性的有Image控件、ImageBrush類等。

  • None   源圖像不拉伸,以原始尺寸填充其容器
  • Uniform   源圖像等比例拉伸,以填充其容器
  • UniformToFill   源圖像等比例拉伸,以填充其容器
  • Fill   源圖像非等比例拉伸,以填充其容器

詳解:

  • None   圖像不膨脹(尺寸不變):圖像和容器左上頂點對齊,容器右、下邊框對圖像右、下部分進行裁剪。如果圖像尺寸小於容器尺寸,則哪邊小哪邊就居中
  • Uniform   圖像等比例“膨脹”:“圖像點”從容器中心處開始等比例“膨脹”,直至圖像某對邊緣第一次觸及容器邊框,膨脹停止(無論容器是否被填滿)
  • UniformToFill   圖像等比例“膨脹”:“圖像點”從容器中心處開始等比例“膨脹”,當圖像某對邊緣第一次觸及容器邊框,若此時容器未被填滿,則膨脹繼續,直至圖像另一對邊緣觸及容器邊框,膨脹停止(此時容器被填滿)
  • Fill   圖像非等比例“膨脹”:“圖像點”從容器中心處開始非等比例“膨脹”,當且僅當某對邊緣觸及容器邊框時,該對邊緣才停止膨脹,否則膨脹繼續


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM