如何避免在GUI调整大小时进行瞬时更新? [英] How to avoid transient updates in a GUI resize?
问题描述
如果您快速地拖动窗口的顶部或左侧边框,您会注意到窗口的相对边缘会振动-它会被拖动,但随后会重新调整以增大尺寸.
If you drag the top or left border of a window semi-quickly, you should notice that the opposite edge of the window vibrates -- it gets dragged, but then re-adjusts to increase the size.
当您具有可动态调整大小的项目时,问题就更加严重了,然后您的许多控件就开始明显地在屏幕上滑动和调整大小.
The problem is a lot worse when you have items that dynamically resize -- then a bunch of your controls start sliding and resizing on the screen, quite visibly.
有什么办法可以防止这些短暂的影响?
Is there any way to prevent these transient effects?
例如也许特定序列响应WM_SIZE
之类的消息可以抑制这种情况?我不知道.
e.g. Perhaps a particular sequence of responding to messages like WM_SIZE
can suppress this? I don't know.
(这似乎发生在我所见过的每个框架中,甚至是普通的Win32.只要打开资源管理器或其他内容并拖动其顶部或左侧,您就会明白我的意思了.)
(It seems to happen in every framework I've seen, even plain Win32. Just open up Explorer or something and drag its top or left edge, and you'll see what I mean.)
推荐答案
响应WM_WINDOWPOSCHANGING
消息,并在WINDOWPOS
结构的flags
成员中设置SWP_NOCOPYBITS
标志.
Respond to the WM_WINDOWPOSCHANGING
message and set the SWP_NOCOPYBITS
flag in the flags
member of the WINDOWPOS
structure.
这篇关于如何避免在GUI调整大小时进行瞬时更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!