本文整理汇总了C++中CBCGPDrawManager类的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPDrawManager类的具体用法?C++ CBCGPDrawManager怎么用?C++ CBCGPDrawManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBCGPDrawManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDocument
void CPeraProcessDesignerView::OnDraw(CDC* pDC)
{
CPeraProcessDesignerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rc;
GetWindowRect(&rc);
rc.MoveToXY(0,0);
CBCGPDrawManager dm (*pDC);
dm.DrawRect( rc, g_crBarBorderIn, g_crBarBorderOut );
if ( m_pViewData != NULL )
{
if ( m_pViewData->m_strFlag.CollateNoCase( viewflagModel ) == 0 )
{
//有时候结构树标题栏下边有条边线不绘制问题
if ( theApp.m_pBarJianmoTree != NULL
&& IsWindow( theApp.m_pBarJianmoTree->GetSafeHwnd() ) )
{
::PostMessage( theApp.m_pBarJianmoTree->GetSafeHwnd(), WM_NCPAINT, 0, 0 );
}
}
}
}
示例2: ASSERT_VALID
//*********************************************************************************************************
void CBCGPVisualManagerVS2008::OnEraseTabsArea (CDC* pDC, CRect rect,
const CBCGPBaseTabWnd* pTabWnd)
{
ASSERT_VALID (pDC);
ASSERT_VALID (pTabWnd);
if (globalData.m_nBitsPerPixel <= 8 || globalData.IsHighContastMode () ||
!pTabWnd->IsVS2005Style () ||
pTabWnd->IsDialogControl ())
{
CBCGPVisualManagerVS2005::OnEraseTabsArea (pDC, rect, pTabWnd);
return;
}
CFrameWnd* pMainFrame = BCGCBProGetTopLevelFrame (pTabWnd);
if (pMainFrame->GetSafeHwnd () != NULL)
{
CRect rectMain;
pMainFrame->GetClientRect (rectMain);
pMainFrame->MapWindowPoints ((CBCGPTabWnd*)pTabWnd, &rectMain);
rect.top = rectMain.top;
rect.left = rectMain.left;
rect.right = rect.left + globalData.m_rectVirtual.Width () + 10;
}
CBCGPDrawManager dm (*pDC);
dm.FillGradient (rect, m_clrBarGradientDark, m_clrBarGradientLight, FALSE, 0);
}
示例3: ASSERT_VALID
//**********************************************************************
void CBCGPToolTipCtrl::OnFillBackground (CDC* pDC, CRect rect, COLORREF& clrText, COLORREF& clrLine)
{
ASSERT_VALID (pDC);
if (m_Params.m_clrFill == (COLORREF)-1)
{
CBCGPVisualManager::GetInstance ()->OnFillToolTip (pDC, this, rect,
clrText, clrLine);
}
else
{
if (m_Params.m_clrFillGradient == (COLORREF)-1)
{
CBrush br (m_Params.m_clrFill);
pDC->FillRect (rect, &br);
}
else
{
CBCGPDrawManager dm (*pDC);
dm.FillGradient2 (rect,
m_Params.m_clrFillGradient, m_Params.m_clrFill,
m_Params.m_nGradientAngle == -1 ? 90 : m_Params.m_nGradientAngle);
}
}
}
示例4: GetClientRect
//**********************************************************************************
void CToolPalette::DoPaint(CDC* pDC)
{
CRect rcClient;
GetClientRect(rcClient);
CBCGPMemDC bufferDC(*pDC, rcClient);
CBCGPToolBar::DoPaint (&bufferDC.GetDC());
CBCGPDrawManager dm (bufferDC.GetDC());
bool bHorizontal = (GetCurrentAlignment() & CBRS_ORIENT_HORZ) != 0; // Toolbar layout mode
EDisplayOptions edo = GetToolbarDisplayOptions();
if ((edo & eDisplaySizeControl) != 0 && !bHorizontal)
{
const int sizeControlHeight = m_imgCaption.GetParams().m_rectImage.Height();
CRect rcSizeControl = rcClient;
rcSizeControl.bottom = rcSizeControl.top + sizeControlHeight;
m_imgCaption.Draw(pDC, rcSizeControl, 1); // 1 is the index of border image
rcClient.top += sizeControlHeight;
}
if ((edo & eDisplayTitle) != 0)
{
CString title;
GetWindowText (title);
CRect rcTitle = rcClient;
if ((edo & eDisplayBorder) != 0)
{
const CRect& rectCorners = m_imgCaption.GetParams().m_rectCorners;
rcTitle.top += rectCorners.top;
}
rcTitle.top += 1;
rcTitle.bottom = rcTitle.top + m_nCaptionHeight;
dm.FillGradient2 (rcTitle, RGB(48, 112, 202), RGB(21, 57, 111), 305);
rcTitle.DeflateRect (1, 2, 1, 2);
CFont* pOldFont = bufferDC.GetDC().SelectObject(&m_fntTitle);
bufferDC.GetDC().SetBkMode(TRANSPARENT);
bufferDC.GetDC().SetTextColor(0xFFFFFF);
bufferDC.GetDC().DrawText (title, rcTitle,
DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
bufferDC.GetDC().SelectObject (pOldFont);
}
if ((edo & eDisplayBorder) != 0)
{
m_imgCaption.DrawFrame (&bufferDC.GetDC(), rcClient, 0); // 0 is the index of border image
}
}
示例5: ASSERT_VALID
//*****************************************************************************************
void CBCGPMenuButton::OnDraw (CDC* pDC, const CRect& rect, UINT uiState)
{
ASSERT_VALID (pDC);
CBCGPDrawOnGlass dog (m_bOnGlass);
CSize sizeArrow = CBCGPMenuImages::Size ();
CRect rectParent = rect;
rectParent.right -= sizeArrow.cx + nImageHorzMargin;
CBCGPButton::OnDraw (pDC, rectParent, uiState);
CRect rectArrow = rect;
rectArrow.left = rectParent.right;
CBCGPMenuImages::Draw (pDC,
m_bRightArrow ? CBCGPMenuImages::IdArowRightLarge : CBCGPMenuImages::IdArowDownLarge,
rectArrow,
(uiState & ODS_DISABLED) ? CBCGPMenuImages::ImageGray :
CBCGPMenuImages::GetStateByColor((m_bVisualManagerStyle && !m_bDontSkin && m_clrText != (COLORREF)-1) ? m_clrText : globalData.clrBtnText, FALSE));
if (m_bDefaultClick)
{
//----------------
// Draw separator:
//----------------
CRect rectSeparator = rectArrow;
rectSeparator.right = rectSeparator.left + 2;
rectSeparator.DeflateRect (0, 2);
if (!m_bWinXPTheme || m_bDontUseWinXPTheme)
{
rectSeparator.left += m_sizePushOffset.cx;
rectSeparator.top += m_sizePushOffset.cy;
}
if (m_bOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawLine (rectSeparator.left, rectSeparator.top, rectSeparator.left, rectSeparator.bottom,
globalData.clrBarDkShadow);
}
else if (m_bVisualManagerStyle && !m_bDontSkin)
{
pDC->Draw3dRect (rectSeparator, globalData.clrBarDkShadow, globalData.clrBarHilite);
}
else
{
pDC->Draw3dRect (rectSeparator, globalData.clrBtnDkShadow, globalData.clrBtnHilite);
}
}
}
示例6: ASSERT_VALID
//***********************************************************************************
void CBCGPVisualManagerVS2005::OnFillHighlightedArea (CDC* pDC, CRect rect,
CBrush* pBrush, CBCGPToolbarButton* pButton)
{
if (pButton != NULL &&
(m_CurrAppTheme == WinXpTheme_Blue || m_CurrAppTheme == WinXpTheme_Olive))
{
ASSERT_VALID (pButton);
CBCGPToolbarMenuButton* pMenuButton =
DYNAMIC_DOWNCAST (CBCGPToolbarMenuButton, pButton);
BOOL bIsPopupMenu = pMenuButton != NULL &&
pMenuButton->GetParentWnd () != NULL &&
pMenuButton->GetParentWnd ()->IsKindOf (RUNTIME_CLASS (CBCGPPopupMenuBar));
if (bIsPopupMenu &&
(pButton->m_nStyle & TBBS_CHECKED) &&
pBrush == &m_brHighlightDn)
{
if (CBCGPToolBarImages::m_bIsDrawOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rect, m_clrBarBkgnd, (COLORREF)-1);
}
else
{
pDC->FillRect (rect, &m_brMenuItemCheckedHighlight);
}
return;
}
if (pMenuButton != NULL && !bIsPopupMenu && pMenuButton->IsDroppedDown ())
{
if (CBCGPToolBarImages::m_bIsDrawOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rect, m_clrBarBkgnd, (COLORREF)-1);
}
else
{
pDC->FillRect (rect, &m_brMenuButtonDroppedDown);
}
return;
}
}
CBCGPVisualManager2003::OnFillHighlightedArea (pDC, rect, pBrush, pButton);
}
示例7: ASSERT_VALID
void CVisualManager::OnDrawSlider (CDC* pDC, CBCGPSlider* pSlider, CRect rect, BOOL bAutoHideMode)
{
if (!CanDrawImage ())
{
CBCGPWinXPVisualManager::OnDrawSlider (pDC, pSlider, rect, bAutoHideMode);
return;
}
ASSERT_VALID (pDC);
ASSERT_VALID (pSlider);
pDC->FillRect (rect, &globalData.brBarFace);
COLORREF clr1E = m_clrSlider[0];
COLORREF clr1S = m_clrSlider[1];
COLORREF clr2E = m_clrSlider[2];
COLORREF clr2S = m_clrSlider[3];
CBCGPDrawManager dm (*pDC);
if (pSlider->IsHorizontal ())
{
rect.top += rect.Height () / 2 - 2;
rect.bottom = rect.top + 3;
dm.Fill4ColorsGradient (rect, clr1S, clr1E, clr1E, clr1S, FALSE);
rect.DeflateRect (0, 1);
dm.Fill4ColorsGradient (rect, clr2S, clr2E, clr2E, clr2S, FALSE);
}
else
{
rect.left += rect.Width () / 2 - 2;
rect.right = rect.left + 3;
dm.Fill4ColorsGradient (rect, clr1E, clr1S, clr1S, clr1E, TRUE);
rect.DeflateRect (1, 0);
dm.Fill4ColorsGradient (rect, clr2E, clr2S, clr2S, clr2E, TRUE);
}
}
示例8: RGB
//*********************************************************************************
void CMacStyle::OnFillOutlookPageButton (CDC* pDC, const CRect& rect,
BOOL bIsHighlighted, BOOL bIsPressed,
COLORREF& clrText)
{
COLORREF clr1 = RGB (139, 139, 139);
COLORREF clr2 = RGB (233, 233, 233);
if (bIsPressed)
{
COLORREF clr = clr1;
clr1 = clr2;
clr2 = clr;
}
else if (bIsHighlighted)
{
clr1 = RGB (153, 153, 153);
clr2 = RGB (255, 255, 255);
}
CBCGPDrawManager dm (*pDC);
dm.FillGradient (rect, clr1, clr2, TRUE);
clrText = RGB (32, 32, 32);
}
示例9: ASSERT_VALID
//*****************************************************************************************
void CBCGPSpinButtonCtrl::OnDraw (CDC* pDC)
{
ASSERT_VALID (this);
ASSERT_VALID (pDC);
CRect rectClient;
GetClientRect (rectClient);
if (GetBuddy ()->GetSafeHwnd () != NULL && (m_bOnGlass || CBCGPToolBarImages::m_bIsDrawOnGlass || m_bVisualManagerStyle))
{
CRect rectBorder (0, 0, 0, 0);
if (GetStyle () & UDS_ALIGNRIGHT)
{
rectBorder = rectClient;
rectClient.DeflateRect (1, 1);
}
else if (GetStyle () & UDS_ALIGNLEFT)
{
rectBorder = rectClient;
rectClient.DeflateRect (1, 1);
}
if (!rectBorder.IsRectEmpty ())
{
visualManager->OnDrawControlBorder (
pDC, rectBorder, this, CBCGPToolBarImages::m_bIsDrawOnGlass || m_bOnGlass);
}
}
if (CBCGPToolBarImages::m_bIsDrawOnGlass || m_bOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);
}
else
{
pDC->FillRect (rectClient, &globalData.brWindow);
}
int nState = 0;
if (m_bIsButtonPressedUp)
{
nState |= SPIN_PRESSEDUP;
}
if (m_bIsButtonPressedDown)
{
nState |= SPIN_PRESSEDDOWN;
}
if (m_bIsButtonHighligtedUp)
{
nState |= SPIN_HIGHLIGHTEDUP;
}
if (m_bIsButtonHighligtedDown)
{
nState |= SPIN_HIGHLIGHTEDDOWN;
}
if (!IsWindowEnabled ())
{
nState |= SPIN_DISABLED;
}
CBCGPDrawOnGlass dog (m_bOnGlass || CBCGPToolBarImages::m_bIsDrawOnGlass);
visualManager->OnDrawSpinButtons (
pDC, rectClient, nState, (GetStyle() & UDS_HORZ) == UDS_HORZ, this);
}
示例10: dc
void CBackgndImageDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (m_Bitmap.GetSafeHandle () == NULL)
{
dc.FillSolidRect (m_rectPreview, ::GetSysColor (COLOR_3DFACE));
CString str = _T("No image to display");
dc.SetBkMode (TRANSPARENT);
dc.DrawText (str, m_rectPreview, DT_CENTER | DT_VCENTER | DT_WORDBREAK);
return;
}
BITMAP bmp;
m_Bitmap.GetBitmap (&bmp);
int cx = bmp.bmWidth;
int cy = bmp.bmHeight;
int cxdest;
int cydest;
CRect rectRest = m_rectPreview;
if (cx > cy)
{
cxdest = m_rectPreview.Width ();
cydest = cx > cxdest ?
m_rectPreview.Height () * cxdest / cx :
m_rectPreview.Height () * cx / cxdest;
rectRest.top += cydest;
}
else
{
cydest = m_rectPreview.Height ();
cxdest = cy > cydest ?
m_rectPreview.Width () * cydest / cy :
m_rectPreview.Width () * cy / cydest;
rectRest.left += cxdest;
}
dc.FillSolidRect (rectRest, ::GetSysColor (COLOR_3DFACE));
CDC dcMem;
dcMem.CreateCompatibleDC (&dc);
CBitmap* pBmpOld = dcMem.SelectObject (&m_Bitmap);
dc.StretchBlt (m_rectPreview.left, m_rectPreview.top, cxdest, cydest,
&dcMem, 0, 0, cx, cy, SRCCOPY);
dcMem.SelectObject (pBmpOld);
CBCGPDrawManager dm (dc);
dm.HighlightRect (CRect (m_rectPreview.TopLeft (), CSize (cxdest, cydest)),
m_iBright);
}
示例11: Default
//**************************************************************************
void CBCGPComboBox::OnPaint()
{
#ifndef _BCGSUITE_
if (globalData.bIsWindows9x)
{
Default();
return;
}
#endif
if ((GetStyle () & 0x0003L) == CBS_SIMPLE)
{
Default ();
return;
}
if (!m_bVisualManagerStyle && !m_bOnGlass)
{
Default ();
return;
}
CPaintDC dc(this); // device context for painting
BYTE alpha = 0;
if (m_bOnGlass)
{
alpha = 255;
}
CBCGPMemDC memDC (dc, this, alpha);
CDC* pDC = &memDC.GetDC ();
CRect rectClient;
GetClientRect (rectClient);
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);
SendMessage (WM_PRINTCLIENT, (WPARAM) pDC->GetSafeHdc (), (LPARAM) PRF_CLIENT);
const int cxDropDown = ::GetSystemMetrics (SM_CXVSCROLL) + 4;
m_rectBtn = rectClient;
m_rectBtn.left = m_rectBtn.right - cxDropDown;
m_rectBtn.DeflateRect (2, 2);
CBCGPDrawOnGlass dog (m_bOnGlass);
CBCGPToolbarComboBoxButton buttonDummy;
#ifndef _BCGSUITE_
buttonDummy.m_bIsCtrl = TRUE;
CBCGPVisualManager::GetInstance ()->OnDrawComboDropButton (
pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
m_bIsButtonHighlighted,
&buttonDummy);
#else
CMFCVisualManager::GetInstance ()->OnDrawComboDropButton (
pDC, m_rectBtn, !IsWindowEnabled (), m_bIsDroppedDown,
m_bIsButtonHighlighted,
&buttonDummy);
#endif
dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrBarShadow);
rectClient.DeflateRect (1, 1);
dm.DrawRect (rectClient, (COLORREF)-1, globalData.clrWindow);
}
示例12: dm
void COptionsPropSheet::OnDrawPageHeader (CDC* pDC, int nPage, CRect rectHeader)
{
CSize sizeIcon = m_Icons.GetImageSize ();
CBCGPDrawManager dm (*pDC);
COLORREF clrBegin, clrFinish;
switch (CBCGPVisualManager2010::GetStyle())
{
case CBCGPVisualManager2010::VS2010_Blue:
clrBegin = RGB(207, 221, 238);
clrFinish = RGB(186, 202, 222);
break;
case CBCGPVisualManager2010::VS2010_Black:
clrBegin = RGB(131, 131, 131);
clrFinish = RGB(57, 57, 57);
break;
case CBCGPVisualManager2010::VS2010_Silver:
clrBegin = RGB(233, 237, 241);
clrFinish = RGB(200, 204, 209);
break;
}
dm.FillGradient (rectHeader, clrBegin, clrFinish);
rectHeader.bottom -= 10;
CRect rectIcon = rectHeader;
rectIcon.left += 20;
rectIcon.right = rectIcon.left + sizeIcon.cx;
m_Icons.DrawEx (pDC, rectIcon, nPage, CBCGPToolBarImages::ImageAlignHorzLeft, CBCGPToolBarImages::ImageAlignVertCenter);
CString strText;
BOOL bNameVaild;
switch (nPage)
{
case 0:
bNameVaild = strText.LoadString(IDS_STRING_CHANGEOPTIONS);
ASSERT(bNameVaild);
break;
case 1:
bNameVaild = strText.LoadString(IDS_STRING_CHANGEVISIT);
ASSERT(bNameVaild);
break;
case 2:
bNameVaild = strText.LoadString(IDS_STRING_LINKEUPDATE);
ASSERT(bNameVaild);
break;
}
CRect rectText = rectHeader;
rectText.left = rectIcon.right + 10;
rectText.right -= 20;
CFont* pOldFont = pDC->SelectObject (&globalData.fontBold);
pDC->SetBkMode (TRANSPARENT);
pDC->SetTextColor (globalData.clrBarText);
UINT uiFlags = DT_SINGLELINE | DT_VCENTER;
CRect rectTextCalc = rectText;
pDC->DrawText (strText, rectTextCalc, uiFlags | DT_CALCRECT);
if (rectTextCalc.right > rectText.right)
{
rectText.DeflateRect (0, 10);
uiFlags = DT_WORDBREAK;
}
pDC->DrawText (strText, rectText, uiFlags);
pDC->SelectObject (pOldFont);
}
示例13: ASSERT_VALID
//*****************************************************************************************
void CBCGPColorButton::OnDraw (CDC* pDC, const CRect& rect, UINT uiState)
{
ASSERT_VALID (pDC);
if (m_pPalette == NULL)
{
RebuildPalette (NULL);
}
CPalette* pCurPalette = pDC->SelectPalette (m_pPalette, FALSE);
pDC->RealizePalette();
CSize sizeArrow = CBCGPMenuImages::Size ();
CRect rectColor = rect;
rectColor.right -= sizeArrow.cx + nImageHorzMargin;
CRect rectArrow = rect;
rectArrow.left = rectColor.right;
COLORREF color = m_Color;
if (color == (COLORREF) -1) // Automatic
{
//---------------------------
// Draw automatic text label:
//---------------------------
color = m_ColorAutomatic;
if (!m_strAutoColorText.IsEmpty ())
{
rectColor.right = rectColor.left + rectColor.Height ();
CRect rectText = rect;
rectText.left = rectColor.right;
rectText.right = rectArrow.left;
CFont* pOldFont = SelectFont (pDC);
ASSERT(pOldFont != NULL);
pDC->SetBkMode (TRANSPARENT);
pDC->SetTextColor (globalData.clrBtnText);
UINT nFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;
if (m_bOnGlass)
{
CBCGPVisualManager::GetInstance ()->DrawTextOnGlass (pDC,
m_strAutoColorText, rectText, nFormat, 0);
}
else
{
pDC->DrawText (m_strAutoColorText, rectText, nFormat);
}
pDC->SelectObject (pOldFont);
}
}
//----------------
// Draw color box:
//----------------
rectColor.DeflateRect (2, 2);
if (m_bOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectColor, (COLORREF)-1, globalData.clrBtnDkShadow);
}
else
{
pDC->Draw3dRect (rectColor, globalData.clrBtnHilite, globalData.clrBtnHilite);
rectColor.DeflateRect (1, 1);
pDC->Draw3dRect (rectColor, globalData.clrBtnDkShadow, globalData.clrBtnDkShadow);
}
rectColor.DeflateRect (1, 1);
if (color != (COLORREF)-1 && (uiState & ODS_DISABLED) == 0)
{
if (globalData.m_nBitsPerPixel == 8) // 256 colors
{
ASSERT_VALID (m_pPalette);
color = PALETTEINDEX (m_pPalette->GetNearestPaletteIndex (color));
}
if (m_bOnGlass)
{
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectColor, color, (COLORREF)-1);
}
else
{
CBrush br (color);
pDC->FillRect (rectColor, &br);
}
}
//----------------------
// Draw drop-down arrow:
//.........这里部分代码省略.........
示例14: Default
void CKofBCGPFontComboBox::OnPaint()
{
if ((GetStyle () & 0x0003L) == CBS_SIMPLE)
{
Default ();
return;
}
if (!m_bVisualManagerStyle && !m_bOnGlass)
{
Default ();
return;
}
CPaintDC dc(this); // device context for painting
BYTE alpha = 0;
if (m_bOnGlass)
{
alpha = 255;
}
CBCGPMemDC memDC (dc, this, alpha);
CDC* pDC = &memDC.GetDC ();
CRect rectClient;
GetClientRect (rectClient);
CBCGPDrawManager dm (*pDC);
dm.DrawRect (rectClient, globalData.clrWindow, (COLORREF)-1);
// 得注释掉这句话
// SendMessage (WM_PRINTCLIENT, (WPARAM) pDC->GetSafeHdc (), (LPARAM) PRF_CLIENT);
const int cxDropDown = ::GetSystemMetrics (SM_CXVSCROLL) + 4;
int nCurSel = GetCurSel();
if (CB_ERR != nCurSel)
{
if (m_Images.GetSafeHandle () == NULL)
{
CBCGPLocalResource locaRes;
m_Images.Create (IDB_BCGBARRES_FONT, nImageWidth, 0, RGB (255, 255, 255));
}
CFont fontSelected;
CFont* pOldFont = NULL;
CRect rc(rectClient);
rc.right -= cxDropDown;
CBCGPFontDesc* pDesc = (CBCGPFontDesc*)GetItemDataPtr(nCurSel);
if (pDesc != NULL)
{
if (pDesc->m_nType & (DEVICE_FONTTYPE | TRUETYPE_FONTTYPE))
{
CPoint ptImage (rc.left + 3, rc.top + (rc.Height () - nImageHeight) / 2);
m_Images.Draw (pDC, pDesc->GetImageIndex (), ptImage, ILD_NORMAL);
}
rc.left += nImageWidth + 9;
if (m_bDrawUsingFont && pDesc->m_nCharSet != SYMBOL_CHARSET)
{
LOGFONT lf;
globalData.fontRegular.GetLogFont (&lf);
lstrcpy (lf.lfFaceName, pDesc->m_strName);
if (pDesc->m_nCharSet != DEFAULT_CHARSET)
{
lf.lfCharSet = pDesc->m_nCharSet;
}
if (lf.lfHeight < 0)
{
lf.lfHeight -= 4;
}
else
{
lf.lfHeight += 4;
}
fontSelected.CreateFontIndirect (&lf);
pOldFont = pDC->SelectObject (&fontSelected);
}
}
CString strText;
GetLBText (nCurSel, strText);
pDC->DrawText (strText, rc, DT_SINGLELINE | DT_VCENTER);
if (pOldFont != NULL)
{
pDC->SelectObject (pOldFont);
}
}
m_rectBtn = rectClient;
m_rectBtn.left = m_rectBtn.right - cxDropDown;
m_rectBtn.DeflateRect (2, 2);
CBCGPDrawOnGlass dog (m_bOnGlass);
//.........这里部分代码省略.........
示例15: AfxGetInstanceHandle
void CImageStyle::FillArea (CDC* pDC, CRect rect, const CWnd* pWnd, BOOL bIsFloating,
BOOL bNCArea)
{
if (m_bmpBack.GetSafeHandle () == NULL)
{
globalData.clrBtnText = m_clrText;
// Load background bitmap:
if (!m_bIsInternalImage)
{
HBITMAP hbmp = (HBITMAP) ::LoadImage (
AfxGetInstanceHandle (),
m_strImagePath,
IMAGE_BITMAP,
0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
VERIFY (hbmp != NULL);
m_bmpBack.Attach (hbmp);
}
else
{
m_bmpBack.LoadBitmap (IDB_BACKGROUND);
}
BITMAP bmp;
m_bmpBack.GetBitmap (&bmp);
m_sizeBmp = CSize (bmp.bmWidth, bmp.bmHeight);
}
int xOffset = rect.left;
int yOffset = rect.top;
if (!bIsFloating &&
!pWnd->IsKindOf (RUNTIME_CLASS (CBCGPPopupMenuBar)))
{
CRect rectMainFrame;
pWnd->GetTopLevelFrame ()->GetWindowRect (rectMainFrame);
pWnd->ScreenToClient (&rectMainFrame);
xOffset = rectMainFrame.left % m_sizeBmp.cx;
yOffset = rectMainFrame.top % m_sizeBmp.cy;
if (bNCArea)
{
CRect rectWindow;
pWnd->GetWindowRect (rectWindow);
pWnd->ScreenToClient (rectWindow);
CRect rectClientActual;
pWnd->GetClientRect (rectClientActual);
xOffset += rectClientActual.left - rectWindow.left;
yOffset += rectClientActual.top - rectWindow.top;
}
}
for (int x = xOffset; x < rect.right; x += m_sizeBmp.cx)
{
for (int y = yOffset; y < rect.bottom; y += m_sizeBmp.cy)
{
pDC->DrawState (CPoint (x, y), m_sizeBmp, &m_bmpBack, 0);
}
}
CBCGPDrawManager dm (*pDC);
dm.HighlightRect (rect, m_nHighlight);
}