Hello Mikhail,
FrameShadows are turned on with calling CXTPCommandBarsFrameHook::EnableFrameTheme(). Differences between these two samples in methods CMainFrame::SetCommandBarsTheme().
> ToolkitPro1800UD.dll!CXTPCommandBarsFrameHook::EnableShadow() Line 1387 C++
ToolkitPro1800UD.dll!CXTPCommandBarsFrameHook::EnableFrameTheme(CXTPCommandBars * pCommandBars) Line 383 C++ ToolkitPro1800UD.dll!CXTPCommandBarsFrameHook::EnableOffice2007Frame(CXTPCommandBars * pCommandBars) Line 404 C++ ToolkitPro1800UD.dll!CXTPCommandBars::EnableFrameTheme(int bEnable) Line 2341 C++ ToolkitPro1800UD.dll!CXTPRibbonBar::EnableFrameTheme(int bEnable) Line 427 C++ RibbonControls.exe!CMainFrame::SetCommandBarsTheme(XTPPaintTheme paintTheme, HINSTANCE__ * hModule, const wchar_t * lpszINI) Line 1049 C++ Old themes don't have FrameShadows and pFramePaintManager->CreateShadow(GetSite()); in method CXTPCommandBarsFrameHook::EnableShadow() returns NULL. So default Ribbon has theme office2007 without frameShadow. But on setting Office2013 theme and enabling "FrameTheme" option again in CXTPCommandBarsFrameHook::EnableFrameTheme() method exits on begining
void CXTPCommandBarsFrameHook::EnableFrameTheme(CXTPCommandBars* pCommandBars){ BOOL bEnabled = pCommandBars != NULL; if (m_bThemeFrameEnabled == bEnabled) return; .... if (pCommandBars) { .... EnableShadow(); } else { DisableFrameTheme(); }
} |
That is why to enable shadows we need to disable "FrameTheme" and then enable again as in CMainFrame::SetCommandBarsTheme() method of RibbonControls sample.
void CMainFrame::SetCommandBarsTheme(XTPPaintTheme paintTheme, HMODULE hModule/*=NULL*/, LPCTSTR lpszINI/*=NULL*/){ CXTPCommandBarsFrameHook::m_bAllowDwm = !(CXTPWinDwmWrapper().IsCompositionEnabled() && (xtpThemeOffice2013 == paintTheme || xtpThemeOffice2007System == paintTheme)); CXTPRibbonBar *pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar, GetCommandBars()->GetMenuBar()); pRibbonBar->EnableFrameTheme(FALSE);
CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars != NULL) { if (hModule != NULL && lpszINI != NULL) { XTPResourceImages()->SetHandle(hModule, lpszINI); CXTPPaintManager::SetTheme(paintTheme); } else if(paintTheme == xtpThemeOfficeXP) // System theme { CXTPPaintManager::SetTheme(paintTheme); } pRibbonBar->EnableFrameTheme(TRUE); } } |
In RibbonSample:
void CMainFrame::SetCommandBarsTheme(XTPPaintTheme paintTheme, LPCTSTR lpszINI/*=NULL*/){ .... if (!m_bOverrideAllowDwm) { m_bAllowDwm = (XTPSystemVersion()->IsWin10OrGreater() ? FALSE : !(CXTPWinDwmWrapper().IsCompositionEnabled() && (xtpThemeOffice2013 == paintTheme || xtpThemeVisualStudio2015 == paintTheme))); } else { pRibbonBar->EnableFrameTheme(FALSE); } .... CXTPPaintManager::SetTheme(paintTheme); .... pRibbonBar->EnableFrameTheme(m_bEnableFrameTheme); .... } |
Regards, Oleksandr Lebed
|