如何使调整WPF窗口的大小不那么“滞后"? [英] How can I make resizing WPF windows less "laggy"?

查看:301
本文介绍了如何使调整WPF窗口的大小不那么“滞后"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF世界中是一个相对较新的人,我立即注意到的一件事是,当您调整窗口大小时,绘制窗口内容的时间是多么漫长.例如,如果您在窗口边缘有滚动条,则这些滚动条在缩小时将部分隐藏,并且在放大时它们与窗口边框之间会留有空间.

I am relatively new in the WPF world and one thing I immediately noticed is how laggy the window content is drawn when you resize a window. For example if you have scrollbars at the window edges those scrollbars will be partly hidden while shrinking and have space between them and the window border when enlarging.

甚至在Visual Studio中创建一个空的WPF项目时也会发生这种情况.更糟糕的是,背景也会发生这种情况,放大后您会看到窗口后面的东西(其他窗口,桌面墙纸等)泄漏出去.

This even happens with an empty WPF project created in Visual Studio. What's even worse is that it also happens with the background and you can see stuff behind the window (other windows, desktop wallpaper, etc.) leak through when enlarging.

起初,我看到原生或WinForms应用程序调整大小就很好(如果编写正确),这是WPF的一个丑陋限制.但是当我查看Expression Blend时,窗口背景保持不透明(尽管窗口内容仍然落后).他们怎么做才能防止出现描述的问题,并且有什么方法可以改善大小以适应更接近的本机/WinForm GUI?

At first I thought that it's an ugly limitation of WPF seeing that native or WinForms applications resize just fine (if written properly). But when I look at Expression Blend the window background stays opaque (though the window content still lags behind). What do they do to prevent described problem and are there any ways to improve resizing to more approximate native/WinForm GUIs?

推荐答案

滞后的原因很好 查看全文

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