如何改变视窗的背景颜色 Windows向窗口发送一个WM_ERASEBKGND消息通知该窗口擦除背景,可以使用
ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回TRUE以
防止Windows擦除窗口。
BOOL CBoxView::OnEraseBkgnd(CDC* pDC)
{CBrush brush(RGB (128 , 0 , 128) );
// Select the brush into the device context .
CBrush* pOldBrush = pDC->SelectObject (&brush);.
CRect rcClip
pDC->GetClipBox (&rcClip);//Paint the area.
pDC-> PatBlt (rcClip.left , rcClip.top ,rcClip.Width() , rcClip.Height() ,PATCOPY );
pDC->SelectObject (pOldBrush );
return TRUE;}
本文地址:http://com.8s8s.com/it/it3404.htm