In the following procedure, you’ll add two member variables to class CScribbleView
that store information about a stroke in progress.
To declare the new member variables
CScribbleView
class. This jumps you directly to the class definition (generated for you by AppWizard) in file ScribbleView.h.
protected:
CStroke* m_pStrokeCur; // The stroke in progress
CPoint m_ptPrev; // The last mouse pt in the stroke
// in progress
The code you just added declares two new protected member variables inside class CScribbleView
— m_pStrokeCur
and m_ptPrev.
You can view the new member variables in the ClassView pane of the Project Workspace window by saving the file and expanding the CScribbleView
class icon.
The following table describes the new member variables.
CScribbleView Data Members
Member | Description |
m_pStrokeCur |
A pointer to the stroke currently being drawn. |
m_ptPrev |
A CPoint object containing the previous mouse coordinates, from which a line will be drawn to the current coordinates. |
The view uses these members to store the information it needs in order to record the points of a stroke in progress.