简体   繁体   中英

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?

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM