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?
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With