MDI child window background, what am I missing?
Okay, I've done some research and I have found information on how to
do this, but something isn't quite working right.
I have an MDI environment, which I am able to set the background of
using the SetClassLong, and this works flawlessly. However, I'd also
like to be able to set the background of the sub windows.
I have subclassed child window with the following implementation of
OnEraseBkgrnd()
BOOL CChildFrame::OnEraseBkgnd(CDC* pDC)
{
// Save old brush
CBrush* pOldBrush = pDC->SelectObject(&m_brush);
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;
}
This does work, when I resize. However, somehow, the MDIclient is
still receiving the event or I'm failing to tell it that it doesn't
need to wipe out the background. The only clue I have is that my sub
window is derived from CMDIChildWnd, as opposed to FrameWnd. I
understand that this probably isn't enough to go on, so please let me
know what you need to dig into the problem.
Thanks for the help,
~Scoots