用VC编程

①添加一个位图基于对话框

onPaint()

{ CClient dc(this);

  CRect rect;

  GetClientRect(&dc);

  CBitmap bmp;

  bmp.LoadBitmaP(IDB_BMP);

  CDC pDC;

  pDC.CreateCompatibleDC(&dc);

  pDC.SelectObject(bmp);

  dc.BitBlt(0,0,200,200,&pDC,0,0,SRCCOPY);

}

②基于单文档的

View:OnDraw(CDC *pDC){

CDC cd;

CBitmap bmp;

bmp.LoadBitmap(IDB_BMP);

dc.CreateCompatibleDC(&pDC);

dc.SelectObject(&pDC);

pDC->BitBlt(0,0,200,200,&dc,0,0,SRCCOPY);

}