[Previous] [Next]

Chapter 10

Scroll Views, HTML Views, and Other View Types

MFC's CView class defines the basic functionality of views, but it is just one of several view classes that MFC places at your disposal. Related classes such as CScrollView, CTreeView, and CHtmlView—all of which are derived, either directly or indirectly, from CView—express added functionality that's yours for the asking when you use them as base classes for view classes of your own. The table below lists the view classes that are available in MFC 6.0 and later.

CView was introduced in Chapter 9, where it was used as the base class for the view in SdiSquares. In this chapter, we'll look at some of the other view classes that MFC offers and examine practical sample code demonstrating their use. First up is CScrollView, which, next to CView, is probably the view class that MFC programmers use most often.

MFC View Classes

Class Name Description
CView Root class for all view classes
CCtrlView Base class for CEditView, CRichEditView, CListView, and CTreeView; can be used to create view classes based on other types of controls
CEditView Wraps the multiline edit control and adds print, search, and search-and-replace capabilities
CRichEditView Wraps the rich edit control
CListView Wraps the list view control
CTreeView Wraps the tree view control
CHtmlView Creates views from HTML files and other media supported by the Microsoft Internet Explorer WebBrowser control
CScrollView Adds scrolling capabilities to CView; base class for
CFormView Implements scrollable "form" views created from dialog templates
CRecordView CFormView derivative designed to display records obtained from an ODBC database
CDaoRecordView DAO version of CRecordView
COleDBRecordView OLE DB version of CRecordView

The CHM file was converted to HTML by chm2web software.