本文整理汇总了C++中CBCGPDrawManager::HighlightRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPDrawManager::HighlightRect方法的具体用法?C++ CBCGPDrawManager::HighlightRect怎么用?C++ CBCGPDrawManager::HighlightRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBCGPDrawManager
的用法示例。
在下文中一共展示了CBCGPDrawManager::HighlightRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
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);
}
示例2: FillArea
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);
}