比例大小图像wpf窗口 [英] proportional size image wpf window

查看:46
本文介绍了比例大小图像wpf窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们用C#代码在WPF应用程序中编写了一个程序,
我们将窗口的大小写为maxisize,
图片不按照比例窗口增加
我们要做的是什么?

请帮助我们!@

we wrote a program in WPF apllication with C# code,
we wrote the size of the window as maxisize,
The picture is not Increases in accordance with proportional window
what we have to do???

please help us!@

推荐答案

尝试为图像使用ViewBox-
http://msdn.microsoft.com/en-us/library/ms752301.aspx [ ^ ]
http://msdn.microsoft. com/en-us/library/system.windows.controls.viewbox.stretch%28v = VS.100%29.aspx [
Try using a ViewBox for your image -
http://msdn.microsoft.com/en-us/library/ms752301.aspx[^]
http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox.stretch%28v=VS.100%29.aspx[^]


这已在WPF中为您完成.您只需要使用类ViewBox,请参见 http://www.keyvan.ms/viewbox-and-viewport -in-windows-presentation-foundation [ ^ ].

—SA
This is already done for you in WPF. All you need is using the class ViewBox, see http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox%28v=VS.100%29.aspx[^].

You need to put your content in an instance of the ViewBox, that''s basically it.

When it scales its single content object, its scales everything in it, any content behaves like scalable vector graphics. You only need to pay attention for the property StretchDirection and take care about preserving the same aspect ratio.

See also this article: http://www.keyvan.ms/viewbox-and-viewport-in-windows-presentation-foundation[^].

—SA


这篇关于比例大小图像wpf窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆