开发者

How to stop a MFC/win32 control re-painting

开发者 https://www.devze.com 2022-12-29 09:53 出处:网络
I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and

I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation, especially if the control starts scrolling. I wondered if there's a neat way for me to stop it repainting for a period. It's actually a custom subclass of CRichEditCtrl in use so I was thinking something like:

void MyCustomEditCtrl::DoAlgorithm()
{
 enableRepaint(false);
 ...
 //to the actual work
 ...
 enableRepaint(true);
}

What's the neatest approach? A custom on-paint handler which does nothing when an operation is in pr开发者_开发技巧ogress? Or can repainting actually be disabled?


I've never used the function but it looks like you want to look at CWnd::SetRedraw.

0

精彩评论

暂无评论...
验证码 换一张
取 消