使用画图打开图片->全选->Ctrl+C,在VC中新建位图, Ctrl+V

解决方案 »

  1.   

    2013没有用过啊,2010里面就是在资源视图里面,在Bitmap里面就是所有的位图资源啊,想要增加就右键,可以新建或者导入。2013应该也差不多吧。
      

  2.   

    你利用CImage 导入图片,然后显示到相应的位置不知道这样会不会清楚一些
      

  3.   

     先把导入的图片添加资源视图,然后工具箱找到picture 控件拖到对话框上面,在控件上面右键选择属性  ,属性TYPE 选择BitMap ,在Image中选择插入的位图。
      

  4.   

    CImage Class 
    CImage provides enhanced bitmap support, including the ability to load and save images in JPEG, GIF, BMP, and Portable Network Graphics (PNG) formats.  
    class CImage
     Collapse imageRes
    CImage takes bitmaps that are either device-independent bitmap (DIB) sections or not; however, you can use Create or CImage::Load with only DIB sections. You can attach a non-DIB section bitmap to a CImage object using Attach, but then you cannot use the following CImage methods, which support only DIB section bitmaps: GetBitsGetColorTableGetMaxColorTableEntriesGetPitchGetPixelAddressIsIndexedSetColorTableTo determine if an attached bitmap is a DIB section, call IsDibSection.NoteNote: 
    Note   In Visual Studio .NET 2003, this class keeps a count of the number of CImage objects created. Whenever the count goes to 0, the function GdiplusShutdown is automatically called to release resources used by GDI+. This ensures that any CImage objects created directly or indirectly by DLLs are always destroyed properly and that GdiplusShutdown is not called from DllMain.
     
    NoteNote: 
    Using global CImage objects in a DLL is not recommended. If you need to use a global CImage object in a DLL, call CImage::ReleaseGDIPlus to explicitly release resources used by GDI+.
     CImage cannot be selected into a new CDC. CImage creates its own HDC for the image. Because an HBITMAP can only be selected into one HDC at a time, the HBITMAP associated with the CImage cannot be selected into another HDC. If you need a CDC, retrieve the HDC from the CImage and give it to CDC::FromHandle. Collapse imageExample
    Visual C++  Copy imageCopy Code 
    // Get a CDC for the image
    CDC* pDC = CDC::FromHandle(m_myImage.GetDC());// Use pDC here
    pDC->Rectangle(0, 40, 100, 50);m_myImage.ReleaseDC();
     When you use CImage in an MFC project, note which member functions in your project expect a pointer to a CBitmap object. If you want to use CImage with such a function, like CMenu::AppendMenu, use CBitmap::FromHandle, pass it your CImage HBITMAP, and use the returned CBitmap*.Visual C++  Copy imageCopy Code 
    void CMyDlg::OnRButtonDown(UINT nFlags, CPoint point)
    {
       UNREFERENCED_PARAMETER(nFlags);   CBitmap* pBitmap = CBitmap::FromHandle(m_myImage);
       m_pmenuPop->AppendMenu(0, ID_BMPCOMMAND, pBitmap);
       ClientToScreen(&point);
       m_pmenuPop->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN, point.x, 
          point.y, this);
    }
     Through CImage, you have access to the actual bits of a DIB section. You can use a CImage object anywhere you previously used a Win32 HBITMAP or DIB section. NoteNote: 
    The following CImage methods have limitations on their use:
     
    Method
     Limitation
     
    PlgBlt
     Works with only Windows NT 4.0 or later. Will not work on applications running on Windows 95/98 or later.
     
    MaskBlt
     Works with only Windows NT 4.0 or later. Will not work on applications running on Windows 95/98 or later.
     
    AlphaBlend
     Works with only Windows 2000, Windows 98, and later systems.
     
    TransparentBlt
     Works with only Windows 2000, Windows 98, and later systems.
     
    Draw
     Supports transparency with only Windows 2000, Windows 98, and later systems.
     See CImage Limitations with Earlier Operating Systems for more detailed information about the limitations on these methods.You can use CImage from either MFC or ATL.NoteNote: 
    When you create a project using CImage, you must define CString before you include atlimage.h. If your project uses ATL without MFC, include atlstr.h before you include atlimage.h. If your project uses MFC (or if it is an ATL project with MFC support), include afxstr.h before you include atlimage.h.Likewise, you must include atlimage.h before you include atlimpl.cpp. To accomplish this easily, include atlimage.h in your stdafx.h.
     Collapse imageRequirements
    Header: atlimage.h
      

  5.   

    什么叫我在导入对话框里面找到我放位图的地方,结果位图不显示出来
    如果你不想写代码
    那么先要把位图文件当作资源导入到工程中
    这个位图资源会有一个资源ID
    然后在对话框上放一个picture control
    然后给这个控件设置导入的资源的ID即可
      

  6.   


    就是导入对话框里面找不到我的文件,后来我选择所有文件就看得到了,但是又有一个问题,我用的vs2013,
    有的位图能够导入,有的导入失败,不知道vs2013对导入的位图尺寸大小,位数等有什么限制吗?最奇怪的是两个位图
    尺寸和位数都一样,偏偏有一个导入失败
      

  7.   

    我找到原因了,我用ps导出bmp图片时,直接在文件名修改格式,而不是改选保存类型,结果得到的图片连windows图片查看器都打不开
      

  8.   

    CImage 是什么啊
    http://blog.csdn.net/xianglifighter/article/details/34840207