在WPF中缩小窗口 [英] Zoom out a window in wpf

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

问题描述

我如何简单地缩小wpf窗口.我不需要任何滑块控件,我只需要在执行程序时缩小窗口即可.对于XAML中的代码,我将不胜感激.

我正在将VS 2010与.NET 3.5一起使用.

谢谢.

Hi, how do I simply Zoom out a window wpf. I do not want any slider control, all I want is the window to be zoomed out when program is executed. I would appreciate a piece of code for that in XAML.

I am using VS 2010 with .NET 3.5.

Thank you.

推荐答案

将XAML内容简单地包装在Viewbox中将自动缩小内容,使它们都适合可见区域:
Simply wrapping your XAML content in a Viewbox will automatically zoom the contents out so they all fit in the viewable area:
<Viewbox>
    <!-- Your content here -->
</Viewbox>



就那么简单.如果要动态缩小或缩放到特定数量,则可以使用ScaleTransform:



Simple as that. If you want to Zoom out dynamically or to a specific amount then you can use a ScaleTransform:

<Grid>
    <Grid.RenderTransform>
        <ScaleTransform ScaleX="0.5" ScaleY="0.5" CenterX="0.5" CenterY="0.5" />
    </Grid.RenderTransform>
    <!-- Your content here -->
</Grid>


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

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