BOOL CMyScrollView::OnEraseBkgnd(CDC* pDC) { // Set brush to desired background color CBrush backBrush(RGB(192, 192, 192)); // Save the old brush CBrush* pOldBrush = pDC->SelectObject(&backBrush); // Get the current clipping boundary CRect rect; pDC->GetClipBox(&rect); // Erase the area needed pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY); pDC->SelectObject(pOldBrush); // Select the old brush back return TRUE; // message handled }
BOOL CWPCEToolsView::OnEraseBkgnd(CDC* pDC)//改变WPCEToolsView背景色 { // TODO: Add your message handler code here and/or call default CBrush Brush (RGB(58,110,165));//生成一兰色刷子 // Select the brush into the device context . CBrush* pOldBrush = pDC->SelectObject(&Brush); // Get the area that needs to be erased . CRect rect; pDC->GetClipBox(&rect); //Paint the area. pDC->PatBlt(rect.left,rect.top,rect.Width(),rect.Height(),PATCOPY); //Unselect brush out of device context . pDC->SelectObject (pOldBrush ); // Return nonzero to half fruther processing . return TRUE; return CView::OnEraseBkgnd(pDC); }
{
// Set brush to desired background color
CBrush backBrush(RGB(192, 192, 192)); // Save the old brush
CBrush* pOldBrush = pDC->SelectObject(&backBrush); // Get the current clipping boundary
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
PATCOPY); pDC->SelectObject(pOldBrush); // Select the old brush back
return TRUE; // message handled
}
{
// TODO: Add your message handler code here and/or call default
CBrush Brush (RGB(58,110,165));//生成一兰色刷子
// Select the brush into the device context .
CBrush* pOldBrush = pDC->SelectObject(&Brush);
// Get the area that needs to be erased .
CRect rect;
pDC->GetClipBox(&rect);
//Paint the area.
pDC->PatBlt(rect.left,rect.top,rect.Width(),rect.Height(),PATCOPY);
//Unselect brush out of device context .
pDC->SelectObject (pOldBrush );
// Return nonzero to half fruther processing .
return TRUE;
return CView::OnEraseBkgnd(pDC);
}