diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 4919129c726..6de4a63c032 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -2549,7 +2549,17 @@ void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncs RECT rcWindow = lpncsp->rgrc[0]; __super::OnNcCalcSize(bCalcValidRects, lpncsp); if (m_bTabsOnTitleBar.value_or(false) && m_wndTabBar.IsVisible()) - lpncsp->rgrc[0].top = rcWindow.top + 0; + { + if (IsZoomed()) + { + lpncsp->rgrc[0].top = rcWindow.top + GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER); + //lpncsp->rgrc[0].left += 1; + //lpncsp->rgrc[0].right -= 1; + lpncsp->rgrc[0].bottom -= 1; + } + else + lpncsp->rgrc[0].top = rcWindow.top + 0; + } } void CMainFrame::OnSize(UINT nType, int cx, int cy) diff --git a/Src/TitleBarHelper.cpp b/Src/TitleBarHelper.cpp index 6c5a8b406ce..692758cc70d 100644 --- a/Src/TitleBarHelper.cpp +++ b/Src/TitleBarHelper.cpp @@ -32,8 +32,7 @@ void CTitleBarHelper::Init(CWnd *pWnd) int CTitleBarHelper::GetTopMargin() const { - return m_maximized ? - GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER) : 0; + return 0; } void CTitleBarHelper::DrawIcon(CWnd* pWnd, CDC& dc) @@ -145,29 +144,27 @@ void CTitleBarHelper::SetSize(int cx, int cy) m_size = CSize(cx, cy); CClientDC dc(m_pWnd); m_dpi = dc.GetDeviceCaps(LOGPIXELSX); - m_pWnd->GetWindowRect(&m_rc); } LRESULT CTitleBarHelper::OnNcHitTest(CPoint pt) { if (!m_pWnd) return HTNOWHERE; - CClientDC dc(m_pWnd); const int leftMargin = PointToPixel(m_leftMargin); const int rightMargin = PointToPixel(m_rightMargin); const int borderWidth = PointToPixel(6); CRect rc; - m_pWnd->GetWindowRect(&rc); - if (pt.y < rc.top + borderWidth) - { - if (pt.x < rc.left + borderWidth) - return HTTOPLEFT; - else if (rc.right - borderWidth <= pt.x) - return HTTOPRIGHT; - return HTTOP; - } + AfxGetMainWnd()->GetWindowRect(&rc); if (!m_maximized) { + if (pt.y < rc.top + borderWidth) + { + if (pt.x < rc.left + borderWidth) + return HTTOPLEFT; + else if (rc.right - borderWidth <= pt.x) + return HTTOPRIGHT; + return HTTOP; + } if (pt.x < rc.left + borderWidth) return HTLEFT; if (rc.right - borderWidth <= pt.x) diff --git a/Src/TitleBarHelper.h b/Src/TitleBarHelper.h index eb091e1fdef..71a86de8b45 100644 --- a/Src/TitleBarHelper.h +++ b/Src/TitleBarHelper.h @@ -41,7 +41,6 @@ class CTitleBarHelper { CWnd* m_pWnd; CSize m_size; - CRect m_rc; bool m_maximized; bool m_bMouseTracking; int m_nTrackingButton;