Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to add an image in the form in vc++??

how to add an image in the form in vc++??

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    savitri
    wrote on last edited by
    #1

    hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)

    J R H 3 Replies Last reply
    0
    • S savitri

      hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)

      J Offline
      J Offline
      jossion
      wrote on last edited by
      #2

      In visual C project (MFC type) go to insert menu and select bitmap option. Browse for your picture file and add it.Under resources tab in the project navigator check the ID of the bitmap file. Then under OnPaint() function add this piece of code. CPaintDC dc(this); CBitmap bmp , *poldBmp; CDC memdc; bmp.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 is the ID of the bitmap loaded mdmdc.CreateCOmpatibleDC(&dc); poldBmp= memdc.SelectObject(&bmp); dc.BitBlt(10,10,47,47,&memdc,0,0,SRCCOPY); memdc.SelectObject(poldBmp); //Do not call CDialog::Onpaint() for painting

      H 1 Reply Last reply
      0
      • S savitri

        hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)

        R Offline
        R Offline
        Rajkumar R
        wrote on last edited by
        #3

        savitri wrote:

        in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program

        I think you are looking for Win forms help. Then I think this is not the message board, you have dedicated message board for WF. Anyway, right click the picture box you have "Choose Image" option in the context menu. Or go to the property View and Image Option has the field to set the Image. And if you looking for Picture Control in win32/MFC, in the property view, set the type of picture control to Bitmap, and specify the ID of the bitmap resource in the Image field

        modified on Tuesday, March 4, 2008 7:47 AM

        1 Reply Last reply
        0
        • S savitri

          hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          You can use of this code for insert image to your control. #include AtlImage.h CImage m; m.Load(_T("c:\\1.jpg")); m_Control.SetBitmap(m_.detach());

          1 Reply Last reply
          0
          • J jossion

            In visual C project (MFC type) go to insert menu and select bitmap option. Browse for your picture file and add it.Under resources tab in the project navigator check the ID of the bitmap file. Then under OnPaint() function add this piece of code. CPaintDC dc(this); CBitmap bmp , *poldBmp; CDC memdc; bmp.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 is the ID of the bitmap loaded mdmdc.CreateCOmpatibleDC(&dc); poldBmp= memdc.SelectObject(&bmp); dc.BitBlt(10,10,47,47,&memdc,0,0,SRCCOPY); memdc.SelectObject(poldBmp); //Do not call CDialog::Onpaint() for painting

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            I think he wants to insert a image to a control(maybe static control or no).

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups