/** * @file XTPFrameThemeNativeWindows11.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "StdAfx.h" #include "GraphicLibrary/unzip/unzip.h" #include "GraphicLibrary/GdiPlus/XTPGdiPlus.h" #include "Common/XTPTypeId.h" #include "Common/XTPCasting.h" #include "Common/XTPMathUtils.h" #include "Common/XTPFramework.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Common/XTPGdiObjects.h" #include "Common/XTPMarkupTheme.h" #include "Common/XTPDrawHelpers.h" #include "Common/XTPResourceImage.h" #include "Common/XTPHookManager.h" #include "Common/XTPColorManager.h" #include "Common/XTPTheme.h" #include "Common/XTPResource.h" #include "Common/XTPResourceManager.h" #include "Common/Hook/XTPWinEventHook.h" #include "Common/FrameShadow/XTPFrameShadowManager.h" #include "Common/FrameShadow/XTPFrameShadow.h" #include "Common/Base/Types/XTPPoint2.h" #include "Common/Base/Types/XTPSize.h" #include "Common/ScrollBar/XTPScrollInfo.h" #include "CommandBars/XTPCommandBarsDefines.h" #include "CommandBars/XTPPaintManager.h" #include "CommandBars/XTPCommandBar.h" #include "CommandBars/XTPToolBar.h" #include "CommandBars/XTPPopupBar.h" #include "CommandBars/Frame/XTPFrameHook.h" #include "CommandBars/Frame/XTPFramePaintManager.h" #include "CommandBars/XTPMenuBar.h" #include "Markup/XTPMarkupObject.h" #include "Markup/XTPMarkupContext.h" #include "Markup/XTPMarkupDrawingContext.h" #include "Markup/Extensions/XTPMarkupStaticExtension.h" #include "Markup/Extensions/XTPMarkupSystemColorsStaticExtension.h" #include "Markup/Extensions/XTPMarkupAmbientColorsStaticExtension.h" #ifdef _XTP_INCLUDE_RIBBON # include "Ribbon/XTPRibbonPopups.h" # include "Ribbon/XTPRibbonBar.h" # include "Ribbon/XTPRibbonPaintManager.h" # include "Ribbon/XTPRibbonMarkupFrameTheme.h" # include "Ribbon/XTPRibbonMarkupTheme.h" #endif #include "CommandBars/Frame/XTPFrameThemeModernUI.h" #include "CommandBars/Frame/XTPFrameThemeOffice2013.h" #include "CommandBars/Frame/XTPFrameThemeNativeWindows11.h" #include "CommandBars/ColorSets/XTPCommandBarsColorSetOffice2013.h" #include "CommandBars/Themes/XTPCommandBarsOfficeXPTheme.h" #include "CommandBars/Themes/XTPCommandBarsModernUITheme.h" #include "CommandBars/Themes/XTPCommandBarsOffice2013Theme.h" #include "CommandBars/Themes/XTPCommandBarsNativeWindows11Theme.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif CXTPFrameThemeNativeWindows11::CXTPFrameThemeNativeWindows11(CXTPPaintManager* pPaintManager) : CXTPFrameThemeOffice2013(pPaintManager) { m_pButtonRestoreActive = new CXTPModernUIFrameCaptionButton(); m_pButtonRestoreInactive = new CXTPModernUIFrameCaptionButton(); m_pButtonRestorePressed = new CXTPModernUIFrameCaptionButton(); m_pButtonRestoreHot = new CXTPModernUIFrameCaptionButton(); m_clrShadowColorActive = COLORREF_NULL; m_clrShadowColorInactive = COLORREF_NULL; m_clrFrameCaptionBorderActive = COLORREF_NULL; m_clrFrameCaptionBorderInactive = COLORREF_NULL; m_clrFrameCaptionAccentTextActive = COLORREF_NULL; XTPGetApplication()->Subscribe(this); m_szWindowCorner = XTP_DPI_SIZE(CSize(16, 16)); } CXTPFrameThemeNativeWindows11::~CXTPFrameThemeNativeWindows11() { XTPGetApplication()->Unsubscribe(this); SAFE_DELETE(m_pButtonRestoreActive); SAFE_DELETE(m_pButtonRestoreInactive); SAFE_DELETE(m_pButtonRestorePressed); SAFE_DELETE(m_pButtonRestoreHot); } void CXTPFrameThemeNativeWindows11::RefreshMetrics() { CXTPFrameThemeOffice2013::RefreshMetrics(); UpdateSystemAccentDependentColors(); m_clrShadowColorActive = XTPIniColor(_T("CommandBars.Frame"), _T("ActiveShadowColor"), RGB(0, 122, 204)); m_clrShadowColorInactive = XTPIniColor(_T("CommandBars.Frame"), _T("InactiveShadowColor"), RGB(48, 48, 48)); m_clrFrameCaptionBorderActive = XTPIniColor(_T("CommandBars.Frame"), _T("ActiveCaptionBorder"), RGB(239, 244, 249)); m_clrFrameCaptionBorderInactive = XTPIniColor(_T("CommandBars.Frame"), _T("InactiveCaptionBorder"), RGB(243, 243, 243)); } CXTPFrameShadow* CXTPFrameThemeNativeWindows11::CreateShadow(CWnd* pFrame) { ASSERT(!XTPFrameShadowManager()->IsShadowEnabled(pFrame)); CXTPFrameShadow* pShadow = XTPFrameShadowManager()->EnableShadow(pFrame, m_clrShadowColorActive, XTPToUInt(XTP_DPI_Y(5)), XTPToUInt(XTP_DPI_Y(8)), 0, 0x80); pShadow->SetClipOwner(FALSE); return pShadow; } void CXTPFrameThemeNativeWindows11::OnShadowedFrameActiveStateChanged(BOOL bActive, CWnd* pFrame, CXTPFrameShadow* pShadow) { ASSERT(pShadow); UNUSED_ALWAYS(pFrame); pShadow->SetColor(bActive ? m_clrShadowColorActive : m_clrShadowColorInactive); } void CXTPFrameThemeNativeWindows11::SetStateColor(COLORREF clrState) { if (clrState == COLORREF_NULL) m_clrFrameBorderActive.SetDefaultValue(); else m_clrFrameBorderActive = clrState; } COLORREF CXTPFrameThemeNativeWindows11::GetStateColor() const { return m_clrFrameBorderActive.IsDefaultValue() ? COLORREF_NULL : m_clrFrameBorderActive.operator COLORREF(); } void CXTPFrameThemeNativeWindows11::DrawFrameCaptionButton(CDC* pDC, CRect rc, int nId, BOOL bSelected, BOOL bPressed, BOOL bActive) { DrawFrameCaptionButton(pDC, rc, nId, bSelected, bPressed, bActive, NULL); } void CXTPFrameThemeNativeWindows11::DrawFrameCaptionButton(CDC* pDC, CRect rc, int nId, BOOL bSelected, BOOL bPressed, BOOL bActive, CXTPRibbonBar* pRibbonBar) { CXTPModernUIFrameCaptionButton* pButton = NULL; switch (nId) { case SC_MINIMIZE: pButton = m_pButtonMinimize; break; case SC_MAXIMIZE: pButton = m_pButtonMaximize; break; case SC_RESTORE: if (bPressed) pButton = m_pButtonRestorePressed; else if (bSelected) pButton = m_pButtonRestoreHot; else if (bActive) pButton = m_pButtonRestoreActive; else if (!bActive) pButton = m_pButtonRestoreInactive; else ASSERT(0); break; case SC_CLOSE: pButton = m_pButtonClose; break; } CXTPColorSetCaptionButton* pColorSet = NULL; BOOL bUseSystemColor = IsUseSystemAccentColorEnabled(); if (bPressed) { if (bUseSystemColor) { pColorSet = (nId == SC_CLOSE) ? &m_csFrameSytemAccentCloseButtonPressed : &m_csFrameSytemAccentCaptionButtonPressed; } else { if (NULL != pRibbonBar && pRibbonBar->IsCaptionBarInBackstageMode()) pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonPressed : &m_csFrameCaptionButtonPressedBSMode; else pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonPressed : &m_csFrameCaptionButtonPressed; } } else if (bSelected) { if (bUseSystemColor) { pColorSet = (nId == SC_CLOSE) ? &m_csFrameSytemAccentCloseButtonHot : &m_csFrameSytemAccentCaptionButtonHot; } else { if (NULL != pRibbonBar && pRibbonBar->IsCaptionBarInBackstageMode()) pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonHot : &m_csFrameCaptionButtonHotBSMode; else pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonHot : &m_csFrameCaptionButtonHot; } } else if (bActive) { if (bUseSystemColor) { pColorSet = (nId == SC_CLOSE) ? &m_csFrameSytemAccentCloseButtonActive : &m_csFrameSytemAccentCaptionButtonActive; } else { if (NULL != pRibbonBar && pRibbonBar->IsCaptionBarInBackstageMode()) pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonActiveBSMode : &m_csFrameCaptionButtonActiveBSMode; else pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonActive : &m_csFrameCaptionButtonActive; } } else if (!bActive) { if (NULL != pRibbonBar && pRibbonBar->IsCaptionBarInBackstageMode()) pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonInactiveBSMode : &m_csFrameCaptionButtonInactiveBSMode; else pColorSet = (nId == SC_CLOSE) ? &m_csFrameCloseButtonInactive : &m_csFrameCaptionButtonInactive; } if (NULL != pColorSet) { ASSERT(NULL != pButton); pButton->SetColors(pColorSet); pButton->RenderMarkup(pDC, rc); } } void CXTPFrameThemeNativeWindows11::LoadParts(HZIP hZip, CXTPMarkupContext* pMarkupContext) { if (m_bMarkupPartsLoaded) return; if (NULL != pMarkupContext) { CXTPMarkupStaticExtension* pRoot = pMarkupContext->GetExtensionRoot(); if (pRoot) { CXTPMarkupStaticExtension* pFrame = new CXTPMarkupStaticExtension(L"Frame"); CXTPMarkupStaticExtension* pColors = new CXTPMarkupStaticExtension(L"Colors"); CXTPMarkupStaticExtension* pTheme = new CXTPMarkupStaticExtension(L"Theme"); pFrame->Extend(new CXTPMarkupPaintManagerBaseThemeBrushStaticExtensionProperty( L"ButtonRestoreActiveBrush", xtpPaintManagerAccentColor, *this)); pFrame->Extend( new CXTPMarkupStaticExtensionBrushProperty(L"ButtonRestoreInactiveBrush", XTPIniColor(_T("CommandBars.Frame"), _T("InactiveCaptionColor"), RGB(255, 255, 255)))); pFrame->Extend(new CXTPMarkupStaticExtensionBrushProperty( L"ButtonRestoreHotBrush", XTPIniColor(_T("CommandBars.Frame"), _T("CaptionButtonHotBackgroundColor"), RGB(213, 225, 242)))); pFrame->Extend(new CXTPMarkupStaticExtensionBrushProperty( L"ButtonRestorePressedBrush", XTPIniColor(_T("CommandBars.Frame"), _T("CaptionButtonPressedBackgroundColor"), RGB(163, 189, 227)))); pColors->Extend(pFrame); pTheme->Extend(pColors); pRoot->Extend(pTheme, TRUE); } } m_bMarkupPartsLoaded = TRUE; // Frame border BOOL bMarkupLoaded = m_pBorderLeft->LoadPart(hZip, _T("Frame/BorderLeft.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pBorderTop->LoadPart(hZip, _T("Frame/BorderTop.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pBorderRight->LoadPart(hZip, _T("Frame/BorderRight.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pBorderBottom->LoadPart(hZip, _T("Frame/BorderBottom.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); // Frame caption buttons bMarkupLoaded = m_pButtonMinimize->LoadPart(hZip, _T("Frame/ButtonMinimize.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonMaximize->LoadPart(hZip, _T("Frame/ButtonMaximize.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonRestoreActive->LoadPart(hZip, _T("Frame/ButtonRestoreActive.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonRestoreInactive->LoadPart(hZip, _T("Frame/ButtonRestoreInactive.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonRestoreHot->LoadPart(hZip, _T("Frame/ButtonRestoreHot.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonRestorePressed->LoadPart(hZip, _T("Frame/ButtonRestorePressed.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); bMarkupLoaded = m_pButtonClose->LoadPart(hZip, _T("Frame/ButtonClose.xaml"), pMarkupContext); ASSERT(bMarkupLoaded); UNREFERENCED_PARAMETER(bMarkupLoaded); } void CXTPFrameThemeNativeWindows11::LoadParts(BOOL bReload /*= FALSE*/) { if (bReload) m_bMarkupPartsLoaded = FALSE; if (m_bMarkupPartsLoaded) return; HMODULE hModule = XTPResourceImages()->GetHandle(); if (NULL == hModule) hModule = XTPGetInstanceHandle(); CXTPResource resource; resource.LoadResource(hModule, GetStyleResourceName(), _T("STYLE")); if (NULL != resource.m_hResource) { HZIP hZip = OpenZip(resource.m_pvResourceData, resource.m_dwSize, NULL); LoadParts(hZip, STATIC_DOWNCAST(CXTPCommandBarsNativeWindows11Theme, m_pPaintManager) ->GetMarkupContext()); CloseZip(hZip); } } void CXTPFrameThemeNativeWindows11::OnAmbientPropertyChanged( CXTPApplication* pApplication, XTPApplicationAmbientProperty nProperty) { UNREFERENCED_PARAMETER(pApplication); ASSERT(NULL != pApplication); if (nProperty != xtpApplicationAccentColor) return; #ifdef _XTP_INCLUDE_RIBBON CXTPRibbonPaintManager* pRibbonPaintManager = STATIC_DOWNCAST(CXTPCommandBarsNativeWindows11Theme, m_pPaintManager) ->GetRibbonPaintManager(); STATIC_DOWNCAST(CXTPRibbonMarkupTheme, pRibbonPaintManager)->LoadParts(TRUE); #endif UpdateSystemAccentDependentColors(); LoadParts(TRUE); m_pPaintManager->RefreshMetrics(); } void CXTPFrameThemeNativeWindows11::UpdateSystemAccentDependentColors() { COLORREF crColor = XTPGetAccentColor(xtpPaintManagerAccentColor); if (COLORREF_NULL != crColor) { m_csFrameSytemAccentCaptionButtonActive.m_clrBackground = crColor; m_csFrameSytemAccentCloseButtonActive.m_clrBackground = crColor; } else { m_csFrameSytemAccentCaptionButtonActive.m_clrBackground.SetDefaultValue(); m_csFrameSytemAccentCloseButtonActive.m_clrBackground.SetDefaultValue(); } crColor = XTPGetAccentColor(xtpPaintManagerHighlightBackAccentColor); if (COLORREF_NULL != crColor) { m_csFrameSytemAccentCaptionButtonHot.m_clrBackground = crColor; m_csFrameSytemAccentCloseButtonHot.m_clrBackground = m_csFrameCloseButtonHot.m_clrBackground.IsDefaultValue() ? crColor : (COLORREF)m_csFrameCloseButtonHot.m_clrBackground; } else { m_csFrameSytemAccentCaptionButtonHot.m_clrBackground.SetDefaultValue(); m_csFrameSytemAccentCloseButtonHot.m_clrBackground = m_csFrameCloseButtonHot.m_clrBackground; } crColor = XTPGetAccentColor(xtpPaintManagerPressedBackAccentColor); if (COLORREF_NULL != crColor) { m_csFrameSytemAccentCaptionButtonPressed.m_clrBackground.SetStandardValue(crColor); m_csFrameSytemAccentCloseButtonPressed.m_clrBackground = m_csFrameCloseButtonPressed.m_clrBackground.IsDefaultValue() ? crColor : (COLORREF)m_csFrameCloseButtonPressed.m_clrBackground; } else { m_csFrameSytemAccentCaptionButtonPressed.m_clrBackground.SetDefaultValue(); m_csFrameSytemAccentCloseButtonPressed.m_clrBackground = m_csFrameCloseButtonPressed.m_clrBackground; } m_clrFrameCaptionAccentTextActive = XTPGetAccentColor(xtpPaintManagerNormalTextAccentColor); } HRGN CXTPFrameThemeNativeWindows11::CalcFrameRegion(CXTPCommandBarsFrameHook* pFrameHook, CSize sz) const { UNREFERENCED_PARAMETER(pFrameHook); return ::CreateRoundRectRgn(0, 0, sz.cx + XTP_DPI_X(1), sz.cy + XTP_DPI_Y(1), m_szWindowCorner.cx, m_szWindowCorner.cy); } void CXTPFrameThemeNativeWindows11::DrawFrame(CDC* pDC, CXTPCommandBarsFrameHook* pFrameHook) { CString strCompat; CXTPResourceImages* pImages = XTPResourceImages(); if (NULL != pImages) strCompat = pImages->GetImageString(_T("Theme"), _T("Compatibility")); XTPPaintTheme paintTheme = m_pPaintManager->GetCurrentTheme(); switch (paintTheme) { case xtpThemeResource: case xtpThemeRibbon: return; case xtpThemeOffice2013: if (strCompat != _T("Office2013")) return; break; case xtpThemeVisualStudio2012: case xtpThemeVisualStudio2012Light: case xtpThemeVisualStudio2012Dark: if (strCompat != _T("VisualStudio2012")) return; break; case xtpThemeVisualStudio2015: if (strCompat != _T("VisualStudio2015")) return; break; case xtpThemeVisualStudio2017: if (strCompat != _T("VisualStudio2017")) return; break; case xtpThemeVisualStudio2019: if (strCompat != _T("VisualStudio2019")) return; break; case xtpThemeVisualStudio2022: if (strCompat != _T("VisualStudio2022")) return; break; case xtpThemeNativeWindows10: if (strCompat != _T("NativeWindows10")) return; break; case xtpThemeNativeWindows11: if (strCompat != _T("NativeWindows11")) return; break; } BOOL bActive = pFrameHook->IsFrameActive(); if (!pFrameHook->IsCaptionVisible()) { DrawFrameBorder(pDC, pFrameHook); return; } CRect rcCaption = CalcFrameCaption(pFrameHook); CRect rcBorder = CalcFrameBorder(pFrameHook); int cx = 0; if ((pFrameHook->GetSiteExStyle() & WS_EX_MDICHILD) != 0) cx = ::GetSystemMetrics(SM_CXFRAME) - 1; { CRgn rgnCaption1, rgnCaption2; rgnCaption1.CreateRectRgn(rcCaption.left, rcCaption.top + XTP_DPI_X(16), rcCaption.right, rcCaption.bottom); rgnCaption2.CreateRoundRectRgn(rcCaption.left, rcCaption.top, rcCaption.right + XTP_DPI_X(1), rcCaption.bottom + XTP_DPI_Y(1), m_szWindowCorner.cx, m_szWindowCorner.cy); rgnCaption1.CombineRgn(&rgnCaption1, &rgnCaption2, RGN_OR); pDC->SelectClipRgn(&rgnCaption1, RGN_XOR); DrawFrameBorder(pDC, pFrameHook); pDC->SelectClipRgn(NULL); rgnCaption1.DeleteObject(); } { CRgn rgnCaption1, rgnCaption2; rgnCaption1.CreateRectRgn(rcCaption.left - cx, rcCaption.top + XTP_DPI_X(16), rcCaption.right + cx, rcCaption.bottom); rgnCaption2.CreateRoundRectRgn(rcCaption.left - cx, rcCaption.top, rcCaption.right + cx + XTP_DPI_X(1), rcCaption.bottom + XTP_DPI_Y(1), m_szWindowCorner.cx, m_szWindowCorner.cy); rgnCaption1.CombineRgn(&rgnCaption1, &rgnCaption2, RGN_OR); { pDC->SelectClipRgn(&rgnCaption1); if (!pFrameHook->IsDwmEnabled()) DrawCaptionBarRegion(pDC, rcCaption, rgnCaption1, pFrameHook->GetSite(), bActive); DrawFrameIcon(pDC, pFrameHook, rcCaption); DrawFrameCaptionButtons(pDC, pFrameHook, rcCaption); rcCaption.left += pFrameHook->CalcFrameBorder().left; DrawCaptionText(pDC, rcCaption, pFrameHook->GetSite(), bActive, pFrameHook->m_pRibbonBar); pDC->SelectClipRgn(NULL); rgnCaption1.DeleteObject(); } } } void CXTPFrameThemeNativeWindows11::DrawFrameBorder(CDC* pDC, CXTPCommandBarsFrameHook* pFrameHook) { CWnd* pSite = pFrameHook->GetSite(); BOOL bActive = pFrameHook->IsFrameActive(); if (!bActive && NULL != pFrameHook->GetShadow() && ::GetActiveWindow() == pFrameHook->GetShadow()->m_hWnd) { bActive = TRUE; } CXTPWindowRect rcWindow(pSite); CXTPClientRect rcClient(pSite); pSite->ClientToScreen(rcClient); rcClient.OffsetRect(-rcWindow.TopLeft()); rcWindow.OffsetRect(-rcWindow.TopLeft()); const int nCaptionHeight = GetSystemMetrics(SM_CYCAPTION); CXTPMarkupThemePart* pPart; pPart = GetFrameBorder(xtpBorderPartTop, bActive); if (NULL != pPart) { CRect rcBorderTop(rcWindow.left, rcWindow.top, rcWindow.right, rcClient.top); pPart->RenderMarkup(pDC, rcBorderTop); } pPart = GetFrameBorder(xtpBorderPartLeftCaption, bActive); if (NULL != pPart) { CRect rcBorderLeftCaption(rcWindow.left, rcClient.top, rcClient.left, rcClient.top + nCaptionHeight); pPart->RenderMarkup(pDC, rcBorderLeftCaption); } pPart = GetFrameBorder(xtpBorderPartLeft, bActive); if (NULL != pPart) { CRect rcBorderLeft(rcWindow.left, rcClient.top + nCaptionHeight, rcClient.left, rcClient.bottom); pPart->RenderMarkup(pDC, rcBorderLeft); } pPart = GetFrameBorder(xtpBorderPartRightCaption, bActive); if (NULL != pPart) { CRect rcBorderRightCaption(rcClient.right, rcClient.top, rcWindow.right, rcClient.top + nCaptionHeight); pPart->RenderMarkup(pDC, rcBorderRightCaption); } pPart = GetFrameBorder(xtpBorderPartRight, bActive); if (NULL != pPart) { CRect rcBorderRight(rcClient.right, rcClient.top + nCaptionHeight, rcWindow.right, rcClient.bottom); pPart->RenderMarkup(pDC, rcBorderRight); } pPart = GetFrameBorder(xtpBorderPartBottom, bActive); if (NULL != pPart) { CRect rcBorderBottom(rcWindow.left, rcClient.bottom, rcWindow.right, rcWindow.bottom); pPart->RenderMarkup(pDC, rcBorderBottom); } } void CXTPFrameThemeNativeWindows11::DrawCaptionBarRegion(CDC* pDC, CRect rcCaptionBar, CRgn& rgnCaptionBar, CWnd* pSite, BOOL bActive) { UNREFERENCED_PARAMETER(pSite); COLORREF crColorBorder; COLORREF crColorCaption; if (bActive) { COLORREF crColor = COLORREF_NULL; if (IsUseSystemAccentColorEnabled()) crColor = XTPGetAccentColor(xtpPaintManagerAccentColor); if (COLORREF_NULL != crColor) { crColorBorder = crColor; crColorCaption = crColor; } else { crColorBorder = m_clrFrameCaptionBorderActive; crColorCaption = m_clrFrameCaptionActive; } } else { crColorBorder = m_clrFrameCaptionBorderInactive; crColorCaption = m_clrFrameCaptionInactive; } CBrush brush(crColorCaption); pDC->FillRgn(&rgnCaptionBar, &brush); brush.DeleteObject(); CRect rcBorder(rcCaptionBar); rcBorder.top = rcBorder.bottom - XTP_DPI_Y(1); pDC->FillSolidRect(rcBorder, crColorBorder); } CRect CXTPFrameThemeNativeWindows11::CalcFrameBorder( const CXTPCommandBarsFrameHook* pFrameHook) const { DWORD dwStyle = pFrameHook->GetSiteStyle(); if ((WS_MAXIMIZE & dwStyle) || pFrameHook->IsDwmEnabled()) return CXTPFrameThemeOffice2013::CalcFrameBorder(pFrameHook); if (0 == (pFrameHook->GetSiteExStyle() & WS_EX_MDICHILD)) return CRect(1, 1, 1, 1); CSize szFrame(::GetSystemMetrics(SM_CXFRAME), ::GetSystemMetrics(SM_CYFRAME)); return (0 != (pFrameHook->GetSiteStyle() & WS_CAPTION) ? CRect(szFrame.cx, XTP_DPI_Y(1), szFrame.cx, szFrame.cy) : CRect(szFrame.cx, szFrame.cy, szFrame.cx, szFrame.cy)); } COLORREF CXTPFrameThemeNativeWindows11::GetFrameCaptionAccentTextColor(BOOL bActive) const { if (!IsUseSystemAccentColorEnabled()) return COLORREF_NULL; return bActive ? m_clrFrameCaptionAccentTextActive : COLORREF_NULL; } // IXTPPaintManagerCustomAccentColorProvider overrides COLORREF CXTPFrameThemeNativeWindows11::GetCustomAccentColor(XTPPaintManagerAccentColor nColor) { if (xtpPaintManagerAccentColor != nColor) { _ASSERTE(!"Unexpected custom accent color requested"); return COLORREF_NULL; } return GetFrameCaptionActiveColor(); }