Bitmap Dialog Class | CodeGuru

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     // […]

Written By
CodeGuru Staff
CodeGuru Staff
Oct 18, 1998
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.