我先建立了一个 mfc appwizard(exe)工程,然后 在 resourse的MENU里点那个
cmainframe 就出来个大框框,最上面是菜单,下面空白了很大面积!我现在想在那个空白的地方贴个图片,请问怎么贴啊???本人是菜鸟?高手不要吝惜你的2分钟,告诉我吧!我用cview类 ,画了个bitbmp图,可是 发现,这种图分辨率很低!!我要是把它变大了,图象就很模糊,很难看!如何弄,可以把bitbmp的分辨率变大啊?(也就解决了我的问题)50分奖励!

解决方案 »

  1.   

    zz显示bmp图象:
    //通过资源画图   
      static   void   DrawBitmap(UINT   bitmap,CDC   *pDC,CRect   rect)   
      {   
          CBitmap   bmp;   
          if   (bmp.LoadBitmap(bitmap))   
          {   
          BITMAP   bmpInfo;   
                  bmp.GetBitmap(&bmpInfo);   
                  CDC   dcMemory;   
                  dcMemory.CreateCompatibleDC(pDC);   
                  dcMemory.SelectObject(&bmp);   
          pDC->SetStretchBltMode(HALFTONE);   
          pDC->StretchBlt(rect.left,rect.top,rect.Width(),rect.Height(),&dcMemory,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,SRCCOPY);   
          }   
      }   
        
      //通过BMP文件画图   
      static   void   drawBitmapFormFile(CString   BitmapFilePath,CDC   *pDC,CRect   rect)   
      {   
      HANDLE   filehandle=::LoadImage(NULL,BitmapFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);   
      if(filehandle!=NULL)   
      {   
      CBitmap   bmp;   
      if(bmp.Attach(filehandle))   
      {   
                                BITMAP   bmpInfo;   
                                bmp.GetBitmap(&bmpInfo);   
                                CDC   dcMemory;   
                                dcMemory.CreateCompatibleDC(pDC);   
                                dcMemory.SelectObject(&bmp);   
                                pDC->SetStretchBltMode(HALFTONE);   
                                pDC->StretchBlt(rect.left,rect.top,rect.Width(),rect.Height(),&dcMemory,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,SRCCOPY);   
        bmp.Detach();   
      }   
      }   
      }
      

  2.   

    在 resourse的MENU里点那个cmainframe 就出来个大框框,最上面是菜单,下面空白了很大面积!我现在想在那个空白的地方贴个图片,请问怎么贴啊???
    --------------------------------------------------------------------------------
    楼主想在IDE中贴图,强!
      

  3.   

    [email protected]先谢谢你们,尤其是  mainmaster(云中漫步)最好告诉我,把你的类怎么放,放哪里(汗!)
      

  4.   

    在 resourse的MENU里点那个cmainframe 就出来个大框框,最上面是菜单,下面空白了很大面积!我现在想在那个空白的地方贴个图片,请问怎么贴啊???
    --------------------------------------------------------------------------------
    楼主想在IDE中贴图,强!
    ---------------------------------------------
    貌似是这样你应该在CView里面用GDI去贴。
      

  5.   

    mainmaster(云中漫步) 先谢谢你!!!邮件收到!
    可是有问题哦!
    我把这些
     CString strDir;
     strDir="c:\\11\\124.bmp";
     if(!m_wndClient.Open(strDir)|
      !m_wndClient.SubclassWindow(m_hWndMDIClient))
      TRACE("Failed\n");
    添加到
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1; if (!m_wndStatusBar.Create(this) ||
    !m_wndStatusBar.SetIndicators(indicators,
      sizeof(indicators)/sizeof(UINT)))
    {
    TRACE0("Failed to create status bar\n");
    return -1;      // fail to create
    } return 0;
    CString strDir;
    CBitmapClient m_wndClient;
     strDir="c:\\11\\124.bmp";
     if(!m_wndClient.Open(strDir)|
      !m_wndClient.SubclassWindow(m_hWndMDIClient))
      TRACE("Failed\n");
    }
    可是运行出的问题是:
    Compiling...
    MainFrm.cpp
    d:\复件 复件 复件 test6\bitmapclient.h(22) : error C2146: syntax error : missing ';' before identifier 'm_hDrawDib'
    d:\复件 复件 复件 test6\bitmapclient.h(22) : error C2501: 'HDRAWDIB' : missing storage-class or type specifiers
    d:\复件 复件 复件 test6\bitmapclient.h(22) : error C2501: 'm_hDrawDib' : missing storage-class or type specifiers
    D:\复件 复件 复件 test6\MainFrm.cpp(73) : error C2065: 'm_hWndMDIClient' : undeclared identifier
    bitmapclient.cpp
    D:\复件 复件 复件 test6\bitmapclient.cpp(5) : fatal error C1083: Cannot open include file: 'PreProcesser.h': No such file or directory
    Generating Code...
    Error executing cl.exe.Test.exe - 5 error(s), 0 warning(s)MY GOD!!怎么办?
      

  6.   

    为什么不用jpg呢,用IPicture去绘制
    bitmap的缩放需要太多的技巧