Microsoft KB Archive/112385

From BetaArchive Wiki
Knowledge Base


Text Output Using CScrollView Derivative

Article ID: 112385

Article Last Modified on 11/21/2006



APPLIES TO

  • Microsoft Foundation Class Library 4.2, when used with:
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 1.5 Professional Edition
    • Microsoft Visual C++ 1.51
    • Microsoft Visual C++ 1.52 Professional Edition
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 2.0 Professional Edition
    • Microsoft Visual C++ 2.1



This article was previously published under Q112385

SUMMARY

The TEXT sample demonstrates how to display and print text using a CScrollView derived class. It is possible to implement text output in a CScrollView class by overriding OnDraw and drawing the entire document using TextOut. However, further steps are required to draw the text efficiently and to include support for multipage documents. Here are the features implemented in this sample and the locations:

Feature                                        Locations(s)
-------                                        ------------

Calculation of various metrics necessary       METRICS.CPP:
for text output:                               CViewMetrics::Compute


Optimized screen and printer output for        TEXTVIEW.CPP:
multipage documents:                           OnDraw (two overrides)
                                               OnPrint
                                               ComputeVisibleLines
                                               ComputePrintableLines

Calculation of page count:                     METRICS.CPP:
                                               CPageMetrics::Compute

Visual indication of pagination:               METRICS.CPP (Calculation)
                                               CPageMetrics::IsPageBreak

                                               TEXTVIEW.CPP (Display)
                                               OnDraw
                                               DrawPageBreak

User-defined margins:                          METRICS.CPP (Calculation)
                                               CMargins::Compute

                                               METRICS.CPP (Validation)
                                               CMargins::IsInvalid

                                               TEXTVIEW.CPP (Display)
                                               OnPrint

Loading text files into a document:            TEXTDOC.CPP
                                               OnOpenDocument
                

MORE INFORMATION

The following files are available for download from the Microsoft Download Center:


Text.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.



Additional query words: mfc text output print preview

Keywords: kbdownload kbuidesign kbwndw kbfile kbsample KB112385