void CBottleView::OnDraw(CDC* pDC)
{
CBottleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here

CRect rect;
GetClientRect(&rect); 
//获取屏幕的宽度和高度
width = rect.right - rect.left;
height = rect.bottom - rect.top;
CDC dcMem;
if (dcMem.CreateCompatibleDC(pDC) == FALSE)
{
AfxMessageBox("无法建立设备内容DC");
}
dcMem.SelectObject(backmap);
pDC->BitBlt((width - 300) / 2, 0, 300, height, &dcMem, 0, goup - 300, SRCCOPY);
pDC->BitBlt((width - 300) , 250, 300, height, &dcMem, 0, goup, SRCCOPY); CClientDC dc(this);问下,为什么这会造成同一图像显示不了在不同的位置?

解决方案 »

  1.   

    问下,为什么这会造成同一图像显示不了在不同的位置?
    你这块的pDC就是当前的现实区域吧
      

  2.   

    为什么这会造成同一图像显示不了在不同的位置? 是下面这两句造成,位置不同嘛。    pDC->BitBlt((width - 300) / 2, 0, 300, height, &dcMem, 0, goup - 300, SRCCOPY);        
        pDC->BitBlt((width - 300) , 250, 300, height, &dcMem, 0, goup, SRCCOPY);