Adding Scrolling

In the current version of Scribble, you cannot work on a drawing that is larger than the window. To allow the user to work on a large drawing, no matter how small the window is, Scribble must support scrolling.

The addition of scrolling expands the conceptual role played by a view. Not only does a view produce a visual representation of a document’s data, it also acts as a peephole to a document that may be too large to display all at once. This peephole can be moved across the document to reveal different portions of it. This is illustrated in the figure below.

A Scrollable View on a Document

Implementing scrolling from scratch is fairly complicated. However, since a lot of the scrolling code is the same for all applications, MFC implements the common scrolling logic in a class called CScrollView.