View Back Ground Color
-
I have an SDI application. I want to change the background of view.... I tried SetBkColor(RGB(255,0,255) in OnDraw(), OnPaint(), but no success... I tried OnCtColor(),,,, it also not works... Any Help?
-
No It not works It has a CDC pointer as a parametre. I created a brush of desired Color,,, and then i Select it pDC->SelectObject(&brush); But no Success!..
Here's an example taken from MSDN: BOOL CSampleView::OnEraseBkgnd(CDC* pDC) { // Set brush to desired background color. CBrush backBrush(RGB(255, 128, 128)); // Save old brush. CBrush* pOldBrush = pDC->SelectObject(&backBrush); CRect rect; pDC->GetClipBox(&rect); // Erase the area needed. pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY); pDC->SelectObject(pOldBrush); return TRUE; } If that doesn't work - which kind of view do you use?