Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The View Class


The class CDrawView is a direct sub class of the MFC class CScrollView. Its task is to alert the document object about mouse and keyboard input from the user, and to (partly or completely) repaint the client area at the request of the document object or the system as well as handle scroll movements. Its only field m_pDrawDoc is a pointer to the document class object. It is initialized by OnCreate.

DrawView.h

class CDrawDoc;

class CDrawView: public CScrollView
{

  private:
    DECLARE_DYNCREATE(CDrawView)
    DECLARE_MESSAGE_MAP()
    CDrawView();

  public:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

    afx_msg void OnSetFocus(CWnd* pOldWnd);
    afx_msg void OnKillFocus(CWnd* pNewWnd);
    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest,
                             UINT message);

    afx_msg void OnLButtonDown(UINT uFlags, CPoint ptMouse);
    afx_msg void OnMouseMove(UINT uFlags, CPoint ptMouse);
    afx_msg void OnLButtonUp(UINT uFlags, CPoint ptMouse...