Fix: Stop the online-host list header from flickering
The list header is a child window of the list view, and LVS_EX_DOUBLEBUFFER only covers the item area. The list view was created without WS_CLIPCHILDREN, so every whole-list Invalidate or RedrawWindow also erased the header with the class background brush before repainting it. On top of that, AdjustColumnWidths ran on every WM_SIZE and issued an unconditional SetColumnWidth per column, and each call repaints the header. The result was an occasional one-frame blink of the header row: irregular, low frequency, and confined to the header because the item area is double-buffered. Both lists now carry WS_CLIPCHILDREN, RDW_ALLCHILDREN was dropped from the redraw calls that only need the list body (that flag forces child repaints even when they are clipped), and column widths are only set when they actually change. The header still needs its background erase, but only for the strip to the right of the last column: AdjustColumnWidths reserves 20px there and the header's own paint stops at the last column, so that strip is colored by WM_ERASEBKGND alone. Skipping the erase entirely left it black after a minimize/restore cycle, when the window contents are discarded. The header subclass now fills just that strip with COLOR_3DFACE and leaves the column area untouched, which keeps the flicker fix, and the needRefresh branch of OnSize forces an erase-redraw of the header so the strip is repainted on minimize/restore and maximize/normalize. Verified with a standalone probe that mirrors the list setup for the header erase counts, and by rebuilding the app and checking the minimize/restore case reported against the first version of this change. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
434812f87d
commit
7160ea8f42
3 files changed
+62
-12
No files matched your search
@@ -23,6 +23,7 @@ public:
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
afx_msg void OnBeginTrack(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
};
|
||||
|
||||
// CListCtrlEx - 支持列显示/隐藏功能的列表控件
|
||||
|
||||
Reference in new issue
Block a user