Basic Tasks for Adding Scrolling

The basic tasks for adding scrolling to your application are as follows:

  1. Define a size for your documents. This can be a constant, a member stored in each document object, or a value calculated at run time, for example.

  2. Derive your view class from CScrollView instead of CView.

    Note   In the AppWizard – Step 6 dialog box, you have the option of changing your base class. You could have, for example, chosen CScrollView instead of CView at that point, thereby eliminating some of the steps in this procedure.

  3. Pass the document’s size to the SetScrollSizes member function of CScrollView whenever the size may change.

  4. Convert between logical coordinates and device coordinates if passing points between graphic device interface (GDI) and non-GDI functions.

The framework’s responsibilities are as follows:

The figure below shows Scribble with scroll bars added.

Scribble with Scrolling Support