VC 显示位图(OnDraw() define)
1 void CActOView::OnDraw(CDC* pDC)
2 {
3 CActODoc* pDoc = GetDocument();
4 ASSERT_VALID(pDoc);
5 // TODO: add draw code for native data here
6 CClientDC dc(this);
7 CDC *mdc=new CDC;
8 mdc->CreateCompatibleDC(&dc);
9 CBitmap bitmap;
10 bitmap.LoadBitmap(IDB_BITMAP1);
11 mdc->SelectObject(bitmap);
12 CRect rect;
13 GetClientRect(&rect);
14 pDC->BitBlt(0,0,rect.right,rect.bottom,mdc,0,0,SRCCOPY);
15 delete mdc;
16 }
2 {
3 CActODoc* pDoc = GetDocument();
4 ASSERT_VALID(pDoc);
5 // TODO: add draw code for native data here
6 CClientDC dc(this);
7 CDC *mdc=new CDC;
8 mdc->CreateCompatibleDC(&dc);
9 CBitmap bitmap;
10 bitmap.LoadBitmap(IDB_BITMAP1);
11 mdc->SelectObject(bitmap);
12 CRect rect;
13 GetClientRect(&rect);
14 pDC->BitBlt(0,0,rect.right,rect.bottom,mdc,0,0,SRCCOPY);
15 delete mdc;
16 }