本文整理汇总了C++中CBCGPRibbonBar::ExportImageToIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRibbonBar::ExportImageToIcon方法的具体用法?C++ CBCGPRibbonBar::ExportImageToIcon怎么用?C++ CBCGPRibbonBar::ExportImageToIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBCGPRibbonBar
的用法示例。
在下文中一共展示了CBCGPRibbonBar::ExportImageToIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDrawIcon
//******************************************************************************
void CBCGPRadialMenuItem::OnDrawIcon(CBCGPGraphicsManager* pGM, BOOL bIsCtrlDisabled, CBCGPImage& icons, CBCGPSize sizeIcon)
{
ASSERT_VALID(pGM);
if (m_ptCenter == CBCGPPoint(-1, -1))
{
return;
}
BOOL bIsDisabled = bIsCtrlDisabled || m_bIsDisabled;
HICON hIcon = NULL;
if (m_hIcon != NULL)
{
hIcon = m_hIcon;
}
else if (m_nImageIndex >= 0)
{
CBCGPPoint ptImage = m_ptCenter;
ptImage.x -= .5 * sizeIcon.cx;
ptImage.y -= .5 * sizeIcon.cy;
pGM->DrawImage(icons, ptImage, sizeIcon, bIsDisabled ? .4 : 1., CBCGPImage::BCGP_IMAGE_INTERPOLATION_MODE_LINEAR,
CBCGPRect(CBCGPPoint(sizeIcon.cx * m_nImageIndex, 0), sizeIcon));
}
else
{
// Try to obtain icon from ribbon/toolbars:
#ifndef _BCGSUITE_
#ifndef BCGP_EXCLUDE_RIBBON
CFrameWnd* pParentFrame = DYNAMIC_DOWNCAST (CFrameWnd, AfxGetMainWnd());
CBCGPRibbonBar* pRibbonBar = NULL;
CBCGPMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST (CBCGPMDIFrameWnd, pParentFrame);
if (pMainFrame != NULL)
{
pRibbonBar = pMainFrame->GetRibbonBar();
}
else // Maybe, SDI frame...
{
CBCGPFrameWnd* pFrame = DYNAMIC_DOWNCAST (CBCGPFrameWnd, pParentFrame);
if (pFrame != NULL)
{
pRibbonBar = pFrame->GetRibbonBar();
}
}
if (pRibbonBar != NULL)
{
ASSERT_VALID(pRibbonBar);
hIcon = pRibbonBar->ExportImageToIcon(m_nID, FALSE);
}
else
#endif
#endif
{
#ifndef _BCGSUITE_
int nImage = CImageHash::GetImageOfCommand(m_nID, FALSE);
#else
int nImage = GetCmdMgr ()->GetCmdImage(m_nID, FALSE);
#endif
CBCGPToolBarImages* pImages = CBCGPToolBar::GetImages();
if (pImages != NULL && nImage >= 0)
{
hIcon = pImages->ExtractIcon(nImage);
}
}
if (hIcon != NULL)
{
m_hIcon = hIcon;
m_bDestroyIcon = TRUE;
}
}
if (hIcon != NULL)
{
CBCGPImage image(hIcon);
sizeIcon = pGM->GetImageSize(image);
CBCGPPoint ptImage = m_ptCenter;
ptImage.x -= .5 * sizeIcon.cx;
ptImage.y -= .5 * sizeIcon.cy;
pGM->DrawImage(image, ptImage, CBCGPSize(), bIsDisabled ? .4 : 1);
}
}