Adding the class to your project
There are three steps you have to follow before you can use this class in your project.
- Add BDialog.cpp and BDialog.h to your project
- Replace all instances of
CDialog
withCBDialog
. Do 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 CDialog
, you 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 tiledStyleStretch
- The background image will be stretchedStyleCenter
- 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 OnInitDialog()
you'll also have to call Invalidate()
to force a repaint of the dialog client area.
int CBDialog::SetBitmap(UINT nIDResource)
nIDResource
- This specifies the resource ID number of the bitmap resource
Return Value
The return value is zero on success and non-zero on failure.
'C & C++ > MFC 컨트롤' 카테고리의 다른 글
Static 에 텍스트를 쓸때 겹쳐서 나올 경우 (0) | 2011.10.25 |
---|---|
마우스 드레그 하여 다이얼 로그 이동 (0) | 2011.10.25 |
MFC 모달 다이알로그를 숨김 상태로 시작하는 방법 (0) | 2011.10.18 |
[List] 가장 최근 값에 고정시키기 (0) | 2011.07.29 |
[Dialog] 윈도우 이전상태 복원 (0) | 2011.05.25 |
댓글