(1)
CBackgroundView::CBackgroundView()
{
CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP_CAR);
m_brushBackground.CreatePatternBrush(&bmp); ///创建位图画刷
}
(2)
void CBackgroundView::OnDraw(CDC* pDC)
{
CBackgroundDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rect;
GetClientRect(rect);///取得客户区域
pDC->FillRect(rect,&m_brushBackground); ///用背景画刷填充区域
}
(3) CBrush m_brushBackground;
然后把要显示的位图放到RES文件夹下,rebuild all即可。