本文整理汇总了C++中CThemeLib::OpenThemeData方法的典型用法代码示例。如果您正苦于以下问题:C++ CThemeLib::OpenThemeData方法的具体用法?C++ CThemeLib::OpenThemeData怎么用?C++ CThemeLib::OpenThemeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CThemeLib
的用法示例。
在下文中一共展示了CThemeLib::OpenThemeData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcCaptionArea
CRect CPropPageFrameDefault::CalcCaptionArea()
{
CRect rect;
GetClientRect(rect);
if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
{
HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
if (hTheme)
{
CRect rectContent;
CDC *pDc = GetDC();
g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
ReleaseDC(pDc);
g_ThemeLib.CloseThemeData(hTheme);
if (GetShowCaption())
rectContent.bottom = rect.top+GetCaptionHeight();
else
rectContent.bottom = rectContent.top;
rect = rectContent;
}
}
else
{
if (GetShowCaption())
rect.bottom = rect.top+GetCaptionHeight();
else
rect.bottom = rect.top;
}
return rect;
}
示例2: DrawCaption
void CPropPageFrameDefault::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
{
COLORREF clrLeft = GetSysColor(COLOR_INACTIVECAPTION);
COLORREF clrRight;
HTHEME hTheme = NULL;
if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
{
hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
}
if (hTheme)
{
clrRight = GetSysColor(COLOR_BTNHIGHLIGHT);
}
else
{
clrRight = GetSysColor(COLOR_BTNFACE);
}
FillGradientRectH(pDc, rect, clrLeft, clrRight);
// draw icon
if (hIcon && m_Images.GetSafeHandle() && m_Images.GetImageCount() == 1)
{
IMAGEINFO ii;
m_Images.GetImageInfo(0, &ii);
CPoint pt(3, rect.CenterPoint().y - (ii.rcImage.bottom-ii.rcImage.top)/2);
m_Images.Draw(pDc, 0, pt, ILD_TRANSPARENT);
rect.left+= (ii.rcImage.right-ii.rcImage.left) + 3;
}
// draw text
rect.left+= 2;
COLORREF clrPrev = pDc->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
int nBkStyle = pDc->SetBkMode(TRANSPARENT);
CFont *pFont = (CFont*)pDc->SelectStockObject(SYSTEM_FONT);
pDc->DrawText(lpszCaption, rect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
pDc->SetTextColor(clrPrev);
pDc->SetBkMode(nBkStyle);
pDc->SelectObject(pFont);
}
示例3: OnEraseBkgnd
BOOL CPropPageFrameDefault::OnEraseBkgnd(CDC* pDC)
{
if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
{
HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
if (hTheme)
{
CRect rect;
GetClientRect(rect);
g_ThemeLib.DrawThemeBackground(hTheme, pDC->m_hDC, TABP_PANE, 0, rect, NULL);
g_ThemeLib.CloseThemeData(hTheme);
return TRUE;
}
}
return CWnd::OnEraseBkgnd(pDC);
}