MFC: How to avoid flickering in child-control updates?

假如想象 提交于 2019-12-06 04:36:22

Did you try SetRedraw()? You can call SetRedraw( FALSE) for child windows so they don't update themselves every time you change the parent and when parent editing is complete you can finally call SetRedraw(TRUE) for childs - and perhaps invalidate at that time so they update themselves only once.

djeidot

Have you tried to override WM_CTLCOLOR? Check out my answer to this post

Note: You can set the background color of the static control by using pDC->SetBkColor and returning a brush with the color you want.

I've done that before by overriding the erase background of the dialog. Then, instead of calling the default function, you prepare are region, traverse all the children of the dialog and clip out their bounds from the region. At the end, you fill the rectangle with the dialog background color.

Basically, the idea is to erase only where there are no controls.

This would would but i'm not sure if there is a better way to do it. Like the 'clip children' option, or i believe there were style for double buffering.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!