Text Output Using CScrollView Derivative

ID: Q112385


The information in this article applies to:
  • The Microsoft Foundation Classes (MFC), used with:
    • Microsoft Visual C++ for Windows, 16-bit edition, versions 1.0, 1.5, 1.51, 1.52
    • Microsoft Visual C++, 32-bit Editions, versions 1.0, 2.0, 2.1


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. Click the file names below to download the files:


Text.exe

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address

http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

Additional query words: mfc text output print preview

Keywords : kbfile kbMFC KbUIDesign kbVC
Version : winnt:1.0,2.0,2.1
Platform : winnt
Issue type :


Last Reviewed: December 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.