Chapter 11 Printing Charts
Introduction
SRGraphView and SRGScrollView support printing and print preview of the chart through the standard MFC print architecture. During the print process a printer GDI is created and the DrawComponentList() function is called to render the chart to the printer. Print preview uses an attribute DC that uses the attributes of the printer to render the chart to the screen, thereby simulating the appearance of the final printed page but in lower resolution.
In both these cases, Objective Chart ensures that the background drawing process is turned off so that the system does not try to create a huge bitmap for the back buffer. If the standard behavior of Objective Chart printing is modified, you must ensure that the background printing is turned off.
Objective Chart uses a simple pagination system to set up the chart for printing. OnBeginPrinting() sets the output rectangle according to the options selected in the Page Setup dialog. This is accomplished by using the SetMaxArea() function to define the boundary of the chart drawing area. Note that OnEndPrinting() removes the area lock from the chart once printing is finished.
Developers are responsible for ensuring that this procedure is maintained when classes are derived from the standard views or new ones are created. If other output rectangle sizes are added to the page setup dialog, OnBeginPrinting() must be modified too.
Objective Chart also contains the SREGraphView and SREScrollView classes, which are CView-based classes that have the added capability of working outside of the classic MFC document/view architecture. These classes enable printing of chart images from within dialogs and other simple controls.