Graphics Reference
In-Depth Information
.
// removed content similar to that from
Listing 2.7 (Tutorial 2.3)
.
BOOL
CTutorialDlg::
OnInitDialog
() {
A2:
m
_
Seconds = 0;
C2:
SetTimer(0, 1000, NULL);
.
void
CTutorialDlg::DoDataExchange(CDataExchange
*
pDX) {
B2:
DDX
_
Text(pDX, IDC
_
MOUSEECHO, m
_
MouseEcho);
DDX
_
Text(pDX, IDC
_
TIMERECHO, m
_
TimerEcho);
.
BEGIN
_
MESSAGE
_
MAP(CTutorialDlg, CDialog)
C3:
ON
_
WM
_
TIMER()
D2:
ON
_
WM
_
LBUTTONDOWN()
ON
_
WM
_
MOUSEMOVE()
ON
_
WM
_
RBUTTONDOWN()
.
C4:
This is the timer service routine.
void
CTutorialDlg::OnTimer(UINT nIDEvent) {
// update time passed and echo to user
m
_
Seconds++;
m
_
TimerEcho.Format("
%
d: Seconds have passed", m
_
Seconds);
UpdateData(
false
);
.
D3:
These are the left/right mouse button down service roune
void
CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point)
void
CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point)
// check if the control/alt/shift key is pressed
if
(nFlags & MK
_
CONTROL)
.
m
_
MouseEcho.Format("
%
sLeft mouse down at
%
d,
%
d", prefix, point.x,
point.y);
UpdateData(
false
);
.
D4:
This is the mouse move service routine
void
CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point)
Listing 2.8.
(cont.)
Search WWH ::
Custom Search