Fix: repaint the log header and the band above it while resizing
Dragging the top or bottom edge of the main window left a strip of stale pixels above the log list and blanked the log header until the window was minimized and restored. Two causes: the per-size layout only moved the group tab, splitter and log list without marking the vacated strips for repaint, and the drag-end redraw of the log list does not include its header child (no RDW_ALLCHILDREN), so a vertical resize never repainted the header. The layout now invalidates the splitter, the group tab and the log list (plus its header) whenever the log area moves, and the drag-end handler repaints the header, tab and splitter synchronously -- only when the client size actually changed, so moving the window costs nothing. Verified: Debug build; repeated top/bottom drags show no ghosting and the log header stays visible. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
ca653ce34b
commit
8c78b44387
1 file changed
+45
@@ -3935,6 +3935,10 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
|
|||||||
rc.right = cx-1; //列表的右坐标
|
rc.right = cx-1; //列表的右坐标
|
||||||
rc.bottom = hideLog ? cy-20 : cy-20-splitPos-SPLITTER_H;
|
rc.bottom = hideLog ? cy-20 : cy-20-splitPos-SPLITTER_H;
|
||||||
m_GroupTab.MoveWindow(rc);
|
m_GroupTab.MoveWindow(rc);
|
||||||
|
// 拖拽改变高度时分组页的底边跟着移动,让出的条带没人重画会在日志
|
||||||
|
// 控件上方留下残影;列表是子窗口且带 WS_CLIPCHILDREN,这里只会重画
|
||||||
|
// 分组页自己的边框/背景,不会牵连列表。
|
||||||
|
m_GroupTab.Invalidate(FALSE);
|
||||||
|
|
||||||
CRect rcInside;
|
CRect rcInside;
|
||||||
m_GroupTab.GetClientRect(&rcInside);
|
m_GroupTab.GetClientRect(&rcInside);
|
||||||
@@ -3979,6 +3983,9 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
|
|||||||
} else {
|
} else {
|
||||||
m_SplitterBar.ShowWindow(SW_SHOW);
|
m_SplitterBar.ShowWindow(SW_SHOW);
|
||||||
m_SplitterBar.MoveWindow(1, cy-20-splitPos-SPLITTER_H, cx-2, SPLITTER_H);
|
m_SplitterBar.MoveWindow(1, cy-20-splitPos-SPLITTER_H, cx-2, SPLITTER_H);
|
||||||
|
// 拖拽改变高度时分割条整条上下移动,让出的那条带没人重画,
|
||||||
|
// 会在日志控件上方留下一条长条残影(松手后才被 OnExitSizeMove 擦掉)。
|
||||||
|
m_SplitterBar.Invalidate(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3987,12 +3994,23 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
|
|||||||
m_CList_Message.ShowWindow(SW_HIDE);
|
m_CList_Message.ShowWindow(SW_HIDE);
|
||||||
} else {
|
} else {
|
||||||
m_CList_Message.ShowWindow(SW_SHOW);
|
m_CList_Message.ShowWindow(SW_SHOW);
|
||||||
|
CRect rcWas;
|
||||||
|
m_CList_Message.GetWindowRect(&rcWas);
|
||||||
|
ScreenToClient(&rcWas);
|
||||||
CRect rc;
|
CRect rc;
|
||||||
rc.left = 1;
|
rc.left = 1;
|
||||||
rc.top = cy-20-splitPos;
|
rc.top = cy-20-splitPos;
|
||||||
rc.right = cx-1;
|
rc.right = cx-1;
|
||||||
rc.bottom = cy-20;
|
rc.bottom = cy-20;
|
||||||
m_CList_Message.MoveWindow(rc);
|
m_CList_Message.MoveWindow(rc);
|
||||||
|
if (rcWas != rc) {
|
||||||
|
// 位置变了就重画表头:竖向拖动时列宽不变,没人触发表头重画,
|
||||||
|
// 标题文字会整行空着(要最小化还原才恢复)。
|
||||||
|
if (CHeaderCtrl* pHeader = m_CList_Message.GetHeaderCtrl()) {
|
||||||
|
pHeader->Invalidate(FALSE);
|
||||||
|
}
|
||||||
|
m_CList_Message.Invalidate(FALSE);
|
||||||
|
}
|
||||||
if (needRefresh) {
|
if (needRefresh) {
|
||||||
m_CList_Message.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
m_CList_Message.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
||||||
}
|
}
|
||||||
@@ -4035,6 +4053,14 @@ void CMy2015RemoteDlg::OnExitSizeMove()
|
|||||||
{
|
{
|
||||||
__super::OnExitSizeMove();
|
__super::OnExitSizeMove();
|
||||||
|
|
||||||
|
// 单纯拖动窗口(标题栏)也会收到 WM_EXITSIZEMOVE,尺寸没变就不必补画。
|
||||||
|
static CSize s_LastExitSize(0, 0);
|
||||||
|
CRect rcClient;
|
||||||
|
GetClientRect(&rcClient);
|
||||||
|
const bool sizeChanged = (rcClient.Width() != s_LastExitSize.cx ||
|
||||||
|
rcClient.Height() != s_LastExitSize.cy);
|
||||||
|
s_LastExitSize = rcClient.Size();
|
||||||
|
|
||||||
// 拖拽调整大小结束后刷新列表,避免残影(表头被 WS_CLIPCHILDREN 裁掉,不会闪)
|
// 拖拽调整大小结束后刷新列表,避免残影(表头被 WS_CLIPCHILDREN 裁掉,不会闪)
|
||||||
if (m_CList_Online.m_hWnd != NULL) {
|
if (m_CList_Online.m_hWnd != NULL) {
|
||||||
CListCtrlEx::ScopedEraseBkgnd scope(m_CList_Online);
|
CListCtrlEx::ScopedEraseBkgnd scope(m_CList_Online);
|
||||||
@@ -4042,6 +4068,25 @@ void CMy2015RemoteDlg::OnExitSizeMove()
|
|||||||
}
|
}
|
||||||
if (m_CList_Message.m_hWnd != NULL) {
|
if (m_CList_Message.m_hWnd != NULL) {
|
||||||
m_CList_Message.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
m_CList_Message.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
||||||
|
// 上面这句不带 RDW_ALLCHILDREN,表头不会跟着重画;竖向拖动时列宽不变,
|
||||||
|
// 也就没有 SetColumnWidth 顺带触发重画,结果是日志列表的标题文字一直空着,
|
||||||
|
// 要等最小化/还原这种整窗重画才恢复。
|
||||||
|
if (sizeChanged) {
|
||||||
|
if (CHeaderCtrl* pHeader = m_CList_Message.GetHeaderCtrl()) {
|
||||||
|
pHeader->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 分组页和分割条在拖动中跟着变高/变矮,让出的条带没人擦,会在日志控件上方
|
||||||
|
// 留下旧像素(看起来像残影)。两者都有 WS_CLIPCHILDREN,擦背景不会盖到列表。
|
||||||
|
if (sizeChanged) {
|
||||||
|
if (m_GroupTab.m_hWnd != NULL) {
|
||||||
|
m_GroupTab.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
|
||||||
|
}
|
||||||
|
if (m_SplitterBar.m_hWnd != NULL) {
|
||||||
|
m_SplitterBar.Invalidate();
|
||||||
|
m_SplitterBar.UpdateWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 更新搜索栏位置(跟随主窗口移动/调整大小)
|
// 更新搜索栏位置(跟随主窗口移动/调整大小)
|
||||||
if (m_pSearchBar && m_pSearchBar->GetSafeHwnd() && m_pSearchBar->IsWindowVisible()) {
|
if (m_pSearchBar && m_pSearchBar->GetSafeHwnd() && m_pSearchBar->IsWindowVisible()) {
|
||||||
|
|||||||
Reference in new issue
Block a user