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 get a image in a .bmp file onto a Dialog in the program?

how to get a image in a .bmp file onto a Dialog in the program?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestionlearning
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.
  • E Offline
    E Offline
    ewighell
    wrote on last edited by
    #1

    what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English

    N H C 4 Replies Last reply
    0
    • E ewighell

      what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      You can use a combination of LoadImage and StretchBlt.


      Nibu thomas Software Developer

      1 Reply Last reply
      0
      • E ewighell

        what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English

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

        And CBitmap and StretchDIBits

        1 Reply Last reply
        0
        • E ewighell

          what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English

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

          I think this way is good #include AtlImage.h CImage m_Image; m_Image.Load("c:\\picture.bmp"); //m_Image.BitBlt(GetDC()->m_hDC,CRect(0,0,800,600),CPoint(0,0)); m_Image.StretchBlt(GetDC()->m_hDC,CRect(0,0,200,200),CRect(0,0,800,600));

          1 Reply Last reply
          0
          • E ewighell

            what I know is the path of the file. and I want to adjust the size of the image on the dialog, too. Thank you very much!!! ------------------- I am learning C++ and English

            C Offline
            C Offline
            Chris Gao
            wrote on last edited by
            #5

            Hi ewighell, There are some steps of doing this: [1] Load the bmp in mem. Your can use CBitmap::Load to do this. the CBitmap class can give you a handle (HBITMAP) to this bitmap. [2] Create a dc by using CDC::CreateCompatibleDC; select the bmp handle into this dc (CDC::SelectObject). [3] Override the dialog's OnPaint function. use CDC::Bitblt or CDC::StretchBlt to render the bmp on to dialog surface. Regards, Chris

            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