Virtual Developer Workshop: Containerized Development with Docker

This class is a "spin off" of the CGTetris application.

There is only one public method:
BOOL SetBitmap(UINT uResource, int Type = CBitmapDialog::BITMAP_TILE);
Type might be one of the following types:
CBitmapDialog::BITMAP_TILE       // tile the bitmap to fill the dialog
CBitmapDialog::BITMAP_STRETCH    // stretch the bitmap so it will fit to the dialog
CBitmapDialog::BITMAP_CENTER     // center the bitmap inside the dialog


The source consists of 6 files:
  1. add all these files to your project.
  2. create a dialog template
  3. add a bitmap resource that you want for the background
  4. create a class for the dialog template
  5. change all occurencies of CDialog in your dialog's .cpp and .h to CBitmapDialog
  6. don't forget to insert "BitmapDialog.h" in either your dialog's header file or in "stdafx.h"
  7. call the CBitmapDialog::SetBitmap() method (in your WM_INITDIALOG handler for instance)
  8. compile your project

Download demo project - 41 KB

Download source - 11 KB


  • WORK like a charm

    Posted by gap001 on 10/08/2005 03:34pm


  • readonly

    Posted by Legacy on 10/21/2003 07:00am

    Originally posted by: bruno leclerc

    In OnCtlColor function, I would like to know if the ctrl is readonly or not. How can I do ? GetWindowLong with ES_READONLY seems to not work.

  • Scroll Redraw background

    Posted by Legacy on 04/08/2003 07:00am

    Originally posted by: Marcus Vinicius


    I need make a program that have a background with height superior at the window. I made the union of two projects (This and a scrolling project) but when i roll the scroll the background can�t be redrawing.

    Good Bytes,

    OctogonEyes (Marcus Vinicius Antunes - Brazil)

  • Having a problem over time

    Posted by Legacy on 04/04/2003 08:00am

    Originally posted by: Bill Hamlin

    I've been using this for over a year now and it works great, except for one little problem. Something happens over time that causes the whole Windows processing of colors to go haywire.

    For one thing the BMPDLG app looks awful and has to be restarted. But if I do something else, like rightclick on an item in the taskbar along the bottom, the popup menu has the wrong colors. Everything is just a little funky, and doesn't get cleared until I restart the machine.

    Has anyone else seen this, and what do you suppose is happening?

    Bill Hamlin


    Posted by Legacy on 02/20/2003 08:00am

    Originally posted by: Chris Kohlhepp

    Hello All,

    I noticed that the header files of the bitmal dialog class contain the following comment : "This is free software. You may redistribute it by any means providing it is not sold for profit without the authors written consent." Kindly allow me to clarify this. Every author at codeguru is giving consent for anyone to use their code even - in commercial applications, i.e "sold for profit". People may, however, not sell the source code for example to re-print it in a book, etc. without the author's permission as the author does retain copyright.

    Just in case anybody was wondering...

    Chris Kohlhepp

  • Bitmap Dialog Class

    Posted by Legacy on 12/11/2002 08:00am

    Originally posted by: Jyoti

    The given source code doesn't work in Win CE.(eVC++ 3.0)
    It doesn't recognize the functions in the dib256.cpp(especially the bitmap related fns such as GetDIBits() etc.)
    But these work perfectly fine in VC ++ 6.0.

    What should be done to get the code working in Win CE (eVC ++ 3.0)?

  • thank you..

    Posted by Legacy on 10/04/2002 07:00am

    Originally posted by: sharkren

    very much

  • Thanks

    Posted by Legacy on 09/20/2002 07:00am

    Originally posted by: MT

    Thanks for the code. Good job.

  • mulitple images on the dialog box

    Posted by Legacy on 09/16/2002 07:00am

    Originally posted by: bvictor

    How do we load two or three separate images(bitmaps or other formats) on the dialog box ?

  • Bitmap error

    Posted by Legacy on 04/06/2002 08:00am

    Originally posted by: Johnny

    I cannot figure this thing out....It keeps on spitting out an error " fatal error C1083: Cannot open include file: 'BitmapDialog.h': No such file or directory" I have BitmapDialog.h inside of the header files. Not to sure what i should do. Any suggestions?

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date