CWnd *pWnd2 = GetDlgItem(IDC_NEWPIC);  //IDC_NEWPIC为一个Static控件
       CBitmap cBitmap;
CDC     dcMemory;
CDC     *pDest = pWnd2->GetDC(); cBitmap.LoadBitmap(dlg.GetPathName()); // Dlg为FileOpen共用对话框,取地址没有错
dcMemory.CreateCompatibleDC(pDest);
dcMemory.SelectObject(&cBitmap); pDest->BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcMemory, 0, 0, SRCCOPY);

解决方案 »

  1.   

    CBitmap可以Load硬盘上的图片吗?
      

  2.   

    不知道,Loads the bitmap resource named by lpszResourceName or identified by the ID number in nIDResource from the application’s executable file. The loaded bitmap is attached to the CBitmap object.应该可以吧。
      

  3.   


    不能Load硬盘上的图片只能Load资源里面的图片要加载硬盘里面的图片比较麻烦但是用GDI+的话就简单了,Bitmap的构造函数支持直接从文件构造