Adding the class to your project
There are three steps you have to follow before you can use this class in
- Add BDialog.cpp and BDialog.h to your project
- Replace all instances of
this to both the cpp and h file of your dialog class. For example if your
project is called Test, make the changes to TestDlg.cpp and
TestDlg.h. You'll have to use Find and Replace.
#include BDialog.h to your dialog header file
So basically we have derived our dialog class from
CBDialog instead of
CDialog, but since
CBDialog is derived from
won't have any problems with your existing code.
Using the class
Basically there are just two methods that you need to call.
void CBDialog::SetBitmapStyle(int style)
style - This is used to set the bitmap background style. You can
use one of the following three styles.
StyleTile - The background image will be tiled
StyleStretch - The background image will be stretched
StyleCenter - The background image will be centered, if it is smaller than the client area of the dialog
You can call this method either from
OnInitDialog() or from any other
place in your dialog class. If you call it outside
also have to call
Invalidate() to force a repaint of the dialog client
int CBDialog::SetBitmap(UINT nIDResource)
nIDResource - This specifies the resource ID number of the bitmap
The return value is zero on success and non-zero on failure.
is a Software Architect/Consultant based out of Columbus, Ohio
. He has over 15 years of software industry experience in various roles including Lead Software Architect
, Principal Software Engineer
, and Product Manager
. Nish is a recipient of the annual Microsoft Visual C++ MVP
Award since 2002 (13 consecutive awards as of 2014).
Nish is an industry acknowledged expert in the Microsoft technology stack. He authored
C++/CLI in Action
for Manning Publications in 2005, and had previously co-authored
Extending MFC Applications with the .NET Framework
for Addison Wesley in 2003. In addition, he has over 140 published technology articles on CodeProject.com and another 250+ blog articles on his
. Nish is vastly experienced in team management, mentoring teams, and directing all stages of software development.
: You can reach Nish on his google email id voidnish
Website and Blog