双缓冲区常用控件 [英] Double buffer common controls

查看:143
本文介绍了双缓冲区常用控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以双重缓冲常见问题控件?目前当他们调整大小他们闪烁。很多.....



编辑:如果它有帮助,它是一堆按钮控件和几个编辑控件,都坐在标签控件的顶部。 Tab控件重绘本身,然后按钮重绘自己。当按钮重画时,它们闪烁。



EDIT2:这是我遇到的问题的一个例子:
http://billy-oneal.com/Lobfuscator.exe

解决方案

使用 WS_EX_COMPOSITED WS_EX_TRANSPARENT 样式。它们提供双缓冲,但是当底层位图完成绘制时,将调用WM_PAINT,因为它从底部到顶部绘制子控件,因此您可以在窗口过程中绘制 。我在过去使用它,工作相当好。



将顶级窗口(容器)设置为扩展样式WS_EX_COMPOSITED,将您的子窗口设置为WS_EX_TRANSPARENT。此外,请务必定义:

  #define WINVER 0x501 

请参阅 CreateWindowEx 以获取合成样式的信息。



关于usign WM_PRINTCLIENT如何转移客户端区域映射到DC上的位图,并将所有客户端区域作为整体进行布局?



http://blogs.msdn.com/larryosterman/archive/2008/08/ 27 / larry-s-new-favourite-windows-message-wm-printclient.aspx


Is there a way to double-buffer the common controls? Currently when they resize they flicker. A lot.....

EDIT: If it helps, it is a bunch of button controls and a few edit controls, all sitting on top of a tab control. The Tab control redraws itself, then the buttons redraw themselves. When the buttons redraw, they flicker.

EDIT2: Here's an example of the problem I'm having: http://billy-oneal.com/Lobfuscator.exe

解决方案

Look at using WS_EX_COMPOSITEDand WS_EX_TRANSPARENT styles. They provide doublebuffering, altough WM_PAINT will be called when the underlying bitmap is finished drawing, since it draws child controls from bottom to top, so you can paint only in your window procedure. I've used it in the past and work pretty well.

Set your top-level window (container) to extended style WS_EX_COMPOSITED and your child windows with WS_EX_TRANSPARENT. Also, remember to define:

#define WINVER 0x501

See CreateWindowEx for information on the composited style. This also makes possible to do perpixel transparency on child windows.

UPDATE

What about usign WM_PRINTCLIENT to transfer the client area to a bitmap on a DC and blit all the client area as a whole?

http://blogs.msdn.com/larryosterman/archive/2008/08/27/larry-s-new-favorite-windows-message-wm-printclient.aspx

这篇关于双缓冲区常用控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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