We help IT Professionals succeed at work.

CChildView Bck Color

win32
win32 asked
on
Hi..

I have made a CChildView in my exe file, to show data. Now the background color in CChildView is white. How does I chage the background colour ?

CB.
Comment
Watch Question

Commented:
Call SetBackgroundColor(); API in your OnInitialUpdate() handler of the View to set the background color.
Commented:
on message WM_ERASEBKGND do what you want do with your background

BOOL CMDI_COLORView::OnEraseBkgnd(CDC* pDC)
{

     CView::OnEraseBkgnd(pDC);

     CRect rect;
     GetClientRect(rect);
     

     pDC->FillSolidRect(&rect, RGB(255,0,0));
         
     return TRUE;
}

Explore More ContentExplore courses, solutions, and other research materials related to this topic.