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. form background bitmap

form background bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelp
3 Posts 3 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.
  • Z Offline
    Z Offline
    zubeido
    wrote on last edited by
    #1

    Hi all! I've been tring to put a bitmap background image on the main Dialog but nearest i can get is this: CDC* pDC=GetDC(); CDC old; //New device context used as the source DC //Creates a deice context compatible to pDC old.CreateCompatibleDC(pDC); CBitmap dlg_bmp; CRect rect; GetClientRect(&rect); dlg_bmp.LoadBitmap(IDB_BITMAP3); CBitmap* oldbmp= old.SelectObject(&dlg_bmp); pDC->BitBlt(rect.left, rect.top, rect.Height(), rect.Width (),&old,0,0,SRCCOPY); old.SelectObject(oldbmp); dlg_bmp.DeleteObject(); //Deletes the bitmap Invalidate(); when this runs the bitmap is loaded and it overrun the other controls hiding them If some one help me i'd be very gratefull AI_Warrior

    M 1 Reply Last reply
    0
    • Z zubeido

      Hi all! I've been tring to put a bitmap background image on the main Dialog but nearest i can get is this: CDC* pDC=GetDC(); CDC old; //New device context used as the source DC //Creates a deice context compatible to pDC old.CreateCompatibleDC(pDC); CBitmap dlg_bmp; CRect rect; GetClientRect(&rect); dlg_bmp.LoadBitmap(IDB_BITMAP3); CBitmap* oldbmp= old.SelectObject(&dlg_bmp); pDC->BitBlt(rect.left, rect.top, rect.Height(), rect.Width (),&old,0,0,SRCCOPY); old.SelectObject(oldbmp); dlg_bmp.DeleteObject(); //Deletes the bitmap Invalidate(); when this runs the bitmap is loaded and it overrun the other controls hiding them If some one help me i'd be very gratefull AI_Warrior

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

      You need to handle WM_ERASEBKGND and paint the bitmap in response to that message. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.

      A 1 Reply Last reply
      0
      • M Michael Dunn

        You need to handle WM_ERASEBKGND and paint the bitmap in response to that message. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.

        A Offline
        A Offline
        Aizaz
        wrote on last edited by
        #3

        try setting the background brush of the dialog box by usning the setclasslong method use GCL_HBRBACKGROUND as the index in the api.

        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