How to set background of MFC dialog? RRS feed

  • Question

  • I actually tried this:

    and its working, but now I've my own bmp/jpg image that i want to make it my MFC dialog background.

    But i failed to add it to the resource/bitmap.

    How can i archive this? because drawing it by my own in Visual studio is kinda annoying when i already have the set of background pictures

    Anyone can give an example? and where i should place those code?

    Tuesday, November 23, 2010 10:00 PM


All replies

  • What error you are getting when you add your own bmp in resource?


    मनोज कुमार जांगिड skype - jangid
    Tuesday, November 23, 2010 10:12 PM
  • i just can't find any place that i can add my bitmap in..
    Tuesday, November 23, 2010 10:41 PM
  • Use LoadImage to load the bitmap from a file on the disk.

    Specify uType as IMAGE_BITMAP and fuLoad as LR_LOADFROMFILE.

    Typecast the returned HANDLE as HBITMAP.

    Microsoft MVP (Visual C++)
    Tuesday, November 23, 2010 10:42 PM
  • Hi,

    In VC, switch to Resource View, right click the BITMAP, select Add resource, then IMPORT you bitmap.


    Tuesday, November 23, 2010 10:47 PM
  • Do you have a problem with adding bitmap to resources, or with code that should display it as a dialog background?

    1) How to: Add or Remove Resources

    2) Drawing background bitmap

    Nikita Leontiev
    Tuesday, November 23, 2010 10:51 PM
  • Hi iry.lee,

    Welcome to MSDN Forum, have you sloved your issue? if you got it working ,Kindly please mark the useful reply as answer.

    By the way, according to your link, we can follow the steps below.

    1.please import your own BITMAP according to renjieluo said;

    2.please input your own BITMAP ID in the  SetBitmap()  ( the  SetBitmap() is in the OnInitDialog() of the BitmapDialogDlg.cpp)

    now you can see your own picture in the dialog.

    Best Regards,



    Tuesday, November 30, 2010 7:25 AM
  • hi, thanks for all the replies.

    i was busy with another project these days, will mark the useful answer once i got a chance to get back to this project with MFC.

    hope thats okay.






    Wednesday, December 1, 2010 4:26 PM
  • Hi iry.lee,

    I temporary make renjieluo's and Nikita's replies as answer. You can unmark it if they provide no help.

    Best Regards,


    Thursday, December 2, 2010 3:58 AM