Graphics Reference
In-Depth Information
class CTutorialDlg
:
public
CDialog {
.
CTutorialDlg(CWnd
*
pParent = NULL);
// standard constructor
virtual BOOL
OnInitDialog();
// The
SystemInitialization()
function
afx
_
msg void
OnPaint();
// To Support
Redraw/Paint
event
DECLARE
_
MESSAGE
_
MAP()
// Identify the events to override from super class
virtual void
DoDataExchange(CDataExchange
*
pDX);
// GUI element input/output support
.
};
TutorialDlg.cpp
: implementation file
···
···
CTutorialDlg::CTutorialDlg(
){
}
// Constructor
Source file.
TutorialDlg.h/cpp
file
in the
Source
and
Header
filefolders of the
MFC
_
SimpleDialog
project.
A:
···
BOOL
CTutorialDlg::
OnInitDialog
() {
}
.
BEGIN
_
MESSAGE
_
MAP
(CTutorialDlg, CDialog)
ON
_
WM
_
PAINT()
.
B:
C:
···
void
CTutorialDlg::
OnPaint
()
{
}
.
D:
···
void
CTutorialDlg::DoDataExchange(CDataExchange
*
pDX)
{
}
.
Listing 2.4.
The
CTutorialDlg
class (Tutorial 2.1).
and exist in all of our projects. Fortunately, the handling of the precompile
header is fairly transparent, and we will not change these files.
Working with the precom-
pile header.
After changing
and/or creating a header file
in a project, it is a good idea
first to recompile
stdafx.cpp
to ensure up-to-date precom-
pile header information.
•
TutorialApp.h/.cpp
. These two files define and implement the
CTutori
alApp
class: Listing 2.3 shows that
CTutorialApp
subclasses from the
API system
CWinApp
. This class represents our application. The global
variable
theApp
represents the instance of our running program. Notice
that our main application window is a
CTutorialDlg
object and is instan-
tiated and invoked in the
InitInstance()
function. When our application
window exits, the control will return to
InitInstance()
and the applica-
tion terminates.
•
TutorialDlg.h/.cpp
. These two files define and implement the
CTutori
alDlg
class. AsshowninListing2.4,
CTutorialDlg
subclasses from the
Search WWH ::
Custom Search