显示16色以上的位图作为背景图

来源:互联网 发布:sar算法 编辑:程序博客网 时间:2024/04/30 04:18

(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即可。

原创粉丝点击