-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBBUTTON.CPP
73 lines (61 loc) · 2.09 KB
/
BBUTTON.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// bbutton.cpp : bitmap button test
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and Microsoft
// WinHelp documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "train.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// BitmapButton Test dialog #1
// In this example we pass the bitmap resource names to LoadBitmaps
// OnInitDialog is used to Subclass the buttons so the dialog
// controls get attached to the MFC WndProc for C++ message map dispatch.
class AFX_CLASS_EXPORT CBMTest1Dlg : public CDialogBar
{
protected:
CBitmapButton button1, button2;
public:
//{{AFX_DATA(CBMTest1Dlg)
enum { IDD = IDD_TEST_BITMAP_BUTTON1 };
//}}AFX_DATA
CBMTest1Dlg();
BOOL OnInitDialog();
//{{AFX_MSG(CBMTest1Dlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CBMTest1Dlg, CDialogBar)
//{{AFX_MSG_MAP(CBMTest1Dlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CBMTest1Dlg::CBMTest1Dlg()
: CDialogBar()
{
// NOTE: The obsolete MFC V1 CBitmapButton constructor with 3 arguments is
// replaced by a call to LoadBitmaps.
if (!button1.LoadBitmaps("Image1Up", "Image1Down", "Image1Focus") ||
!button2.LoadBitmaps("Image2Up", "Image2Down", "Image2Focus"))
{
TRACE("Failed to load bitmaps for buttons\n");
AfxThrowResourceException();
}
}
BOOL CBMTest1Dlg::OnInitDialog()
{
// each dialog control has special bitmaps
VERIFY(button1.SubclassDlgItem(IDOK, this));
button1.SizeToContent();
VERIFY(button2.SubclassDlgItem(IDCANCEL, this));
button2.SizeToContent();
return TRUE;
}