Bitmap Dialog Class

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


Usage


The source consists of 6 files:

BitmapDialog.[h|cpp]

dib256.[h|cpp]

dibpal.[h|cpp]


  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

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read