Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pause Rendering/Drawing CTreeCtrl (MFC)

Is there a way to pause the rendering of a CTreeCtrl or its CTreeView during an expensive operation like expanding/collapsing all nodes in a tree? If there's no function for it like PauseRendering(TRUE) or something similar, would it be possible to maybe intercept the draw message and only forward it to the tree if my ExpandAll method wasn't being called?

like image 880
jake Avatar asked Dec 03 '25 23:12

jake


1 Answers

You can use the WM_SETREDRAW message: when sent with wParam to FALSE it will prevent the window from receiving WM_PAINT messages; when sent with wParam to TRUE it will be set to normal.

Don't forget to manually repaint the window after you are done, because it is not done automatically:

RedrawWindow(hWnd, NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN);
like image 148
rodrigo Avatar answered Dec 05 '25 13:12

rodrigo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!