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 set an image as background for dialog box or form

how to set an image as background for dialog box or form

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
4 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
    suthakar56
    wrote on last edited by
    #1

    Hi, how to set an image as a background for dialog box or form in vc++? Thanks in advance..

    M Z 2 Replies Last reply
    0
    • S suthakar56

      Hi, how to set an image as a background for dialog box or form in vc++? Thanks in advance..

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      See the FAQ: 4.2: How do I change the background color of a dialog, or draw a picture in the background of my window?[^]

      --Mike-- Dunder-Mifflin, this is Pam.

      _ 1 Reply Last reply
      0
      • S suthakar56

        Hi, how to set an image as a background for dialog box or form in vc++? Thanks in advance..

        Z Offline
        Z Offline
        zhyp_208
        wrote on last edited by
        #3

        void CClass::OnPaint() { CPaintDC dc(this); // device context for painting CPaintDC dcc(this); CRect rect; GetClientRect(&rect); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpBackground; bmpBackground.LoadBitmap(IDB_BITMAP1); //IDB_BITMAP1 is the image ID BITMAP bitmap; bmpBackground.GetBitmap(&bitmap); CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground); dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0, bitmap.bmWidth,bitmap.bmHeight,SRCCOPY); }

        1 Reply Last reply
        0
        • M Michael Dunn

          See the FAQ: 4.2: How do I change the background color of a dialog, or draw a picture in the background of my window?[^]

          --Mike-- Dunder-Mifflin, this is Pam.

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          I wonder why your posting was down voted. I have compensated it. :)

          «_Superman_» I love work. It gives me something to do between weekends.

          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