Skip to content

Commit

Permalink
修正更换皮肤后主窗口会有一段时间显示空白的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyang219 committed Jan 12, 2025
1 parent 30be03c commit 729009d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion TrafficMonitor/SkinFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ void CSkinFile::DrawItemsInfo(IDrawCommon& drawer, Layout& layout, CFont& font)
plugin->OnExtenedInfo(ITMPlugin::EI_VALUE_TEXT_COLOR, std::to_wstring(cl).c_str());
plugin->OnExtenedInfo(ITMPlugin::EI_DRAW_TASKBAR_WND, L"0");
}
drawer.GetDC()->SetTextColor(cl);
drawer.SetTextColor(cl);
plugin_item->DrawItem(drawer.GetDC()->GetSafeHdc(), layout_item.x, layout_item.y, layout_item.width, m_layout_info.text_height, brightness >= 128);
}
else
Expand Down
20 changes: 10 additions & 10 deletions TrafficMonitor/TrafficMonitorDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,7 @@ void CTrafficMonitorDlg::SetTransparency()

void CTrafficMonitorDlg::SetTransparency(int transparency)
{
//清除窗口的分层样式
LONG style = GetWindowLong(m_hWnd, GWL_EXSTYLE);
style &= ~WS_EX_LAYERED;
SetWindowLong(m_hWnd, GWL_EXSTYLE, style);

//重新设置窗口的分层样式
style |= WS_EX_LAYERED;
SetWindowLong(m_hWnd, GWL_EXSTYLE, style);

SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
if (m_skin.IsPNG())
{
m_skin.SetAlpha(transparency * 255 / 100);
Expand Down Expand Up @@ -2430,7 +2422,15 @@ void CTrafficMonitorDlg::OnChangeSkin()
}
SetItemPosition();
Invalidate(FALSE); //更换皮肤后立即刷新窗口信息
SetTransparency(); //调用SetTransparency函数重新设置WS_EX_LAYERED样式,以解决在png皮肤和bmp皮肤之间切换时显示不正常的问题
//重新设置WS_EX_LAYERED样式,以解决在png皮肤和bmp皮肤之间切换时显示不正常的问题
//清除窗口的分层样式
LONG style = GetWindowLong(m_hWnd, GWL_EXSTYLE);
style &= ~WS_EX_LAYERED;
SetWindowLong(m_hWnd, GWL_EXSTYLE, style);
//重新设置窗口的分层样式
style |= WS_EX_LAYERED;
SetWindowLong(m_hWnd, GWL_EXSTYLE, style);

theApp.SaveConfig();
}
}
Expand Down

0 comments on commit 729009d

Please sign in to comment.