How to stop a MFC/win32 control re-painting

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-05T09:03:23Z Indexed on 2010/05/05 10:08 UTC
Read the original article Hit count: 131

Filed under:
|
|
|

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 progress? Or can repainting actually be disabled?

© Stack Overflow or respective owner

Related posts about cricheditctrl

Related posts about mfc