本文整理汇总了C++中CBrush::UnrealizeObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CBrush::UnrealizeObject方法的具体用法?C++ CBrush::UnrealizeObject怎么用?C++ CBrush::UnrealizeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBrush
的用法示例。
在下文中一共展示了CBrush::UnrealizeObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEraseBkgnd
BOOL COXTabWorkspace::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetWindowRect(rect);
ScreenToClient(rect);
rect.right += m_dwOffset;
rect.bottom += m_dwOffset;
CBrush brush;
brush.CreateSolidBrush(GetSysColor(COLOR_3DFACE));
brush.UnrealizeObject();
pDC->FillRect(rect, &brush);
return TRUE;
}
示例2: OnEraseBkgnd
BOOL CSnapView::OnEraseBkgnd(CDC* pDC)
{
CBrush* pOldBrush;
CBrush backBrush;
backBrush.CreateSolidBrush(::GetSysColor(COLOR_3DLIGHT));
backBrush.UnrealizeObject();
CRect rectClient;
GetClientRect(rectClient);
pOldBrush = pDC->SelectObject(&backBrush);
pDC->Rectangle(rectClient);
pDC->SelectObject(pOldBrush);
return TRUE;
}
示例3: OnDraw
void CDrawView::OnDraw(CDC* pDC)
{
CDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CDC dc;
CDC* pDrawDC = pDC;
CBitmap bitmap;
CBitmap* pOldBitmap;
// only paint the rect that needs repainting
CRect client;
pDC->GetClipBox(client); //检取当前裁剪边界的最近限定矩形的大小
CRect rect = client;
DocToClient(rect);
rect.NormalizeRect();
TRACE("CDrawView::OnDraw\n");
if (!pDC->IsPrinting())//不加会闪屏
{
// draw to offscreen bitmap for fast looking repaints
if (dc.CreateCompatibleDC(pDC)) //创建一个与指定设备兼容的内存设备上下文环境
{
if (bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height()))//创建与指定的设备环境相关的设备兼容的位图
{
OnPrepareDC(&dc, NULL);
pDrawDC = &dc;
// offset origin more because bitmap is just piece of the whole drawing
dc.OffsetViewportOrg(-rect.left, -rect.top);//相对于当前视区起点坐标修正视区起点坐标
pOldBitmap = dc.SelectObject(&bitmap); //选择一对象到指定的设备上下文环境中
dc.SetBrushOrg(rect.left % 8, rect.top % 8);//指定GDI将分配给下画笔应用程序选择到设备上下文的原点
// might as well clip to the same rectangle
dc.IntersectClipRect(client); //创建了一个新的剪切区域,该区域是当前剪切区域和一个特定矩形的交集
}
}
}
// paint background
CBrush brush;
if (!brush.CreateSolidBrush(pDoc->GetPaperColor()))
return;
brush.UnrealizeObject(); //重置一个逻辑调色板
pDrawDC->FillRect(client, &brush); //用指定的画刷填充矩形
Painter::GetInstancePtr()->SetCDC(pDrawDC);
Painter::GetInstancePtr()->SetCWnd(this);
if (!pDC->IsPrinting() && m_bGrid)
DrawGrid(pDrawDC);
g_pGuiManager->Draw();
if (pDrawDC != pDC)
{
pDC->SetViewportOrg(0, 0);
pDC->SetWindowOrg(0,0);
pDC->SetMapMode(MM_TEXT);
dc.SetViewportOrg(0, 0);
dc.SetWindowOrg(0,0);
dc.SetMapMode(MM_TEXT);
pDC->BitBlt(rect.left, rect.top, rect.Width(), rect.Height(),
&dc, 0, 0, SRCCOPY);
dc.SelectObject(pOldBitmap);
}
}