开发者

Shrinking Images rather than Stretching

I am having a little trouble in WPF - I am fully aware of the image stretch function and how to use it, and have that working fine. What I am trying to do however, is only apply the stretch if the image is too large (essentially to make it a shrink), and retain the original size if the i开发者_运维问答mage would fit into the view. The stretch method currently performs the shrinking perfectly, but will expand smaller images to fill the view which is not what I am after.

Is there a simple way of doing this?


you have to use the StretchDirection property in conjunction with the Stretch Property:

image.StretchDirection = StretchDirection.DownOnly;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜