Click here to Skip to main content
11,505,123 members (69,690 online)
Click here to Skip to main content

An Advanced Preview within Doc/Vew architecture

, 12 Oct 2000 113.2K 2.4K 29
Rate this:
Please Sign up or sign in to vote.
A simple class that helps provide faster Print Preview within MFC Doc/View applications
<!-- Download Links -->
  • Download source files - 25 Kb
  • Download demo application - 14 Kb
  • <!-- Article image -->

    Sample Image - AdvancedPrev.jpg

    It is often important to MFC programmers to speed up the Print Preview display within their Document/View application.

    I would like to present some of my improvements as to the Preview procedure of printing that I experienced during my recent developpment of a large system. I extended the MFC Preview procedure to create a flicker free system using the BitBlt function.

    You can see an outline of the ExtPreviewView class definition below. This class is derived from MFCs CPreviewView described in MFC Technical Note 30. The three protected members save virtual viewport data. Through the initialization of the MFC Preview procedure, the InitVxPrintOffset() function is exectued once and sets the values of the members mentioned above. Therefore you are able to create a Bitmap on memory DC which is compatible with the Preview DC in MFC for high-speed drawing, using the maximum size of the virtual paper.

    // override MFC class
    class ExtPreviewView : public CPreviewView
    {
    	...
    protected:
    	// Original viewport point of memory DC
    	CSize m_VxPrintOffset;
    	CSize m_sizeVxVpExt, m_sizeVxWinExt;
    public:
    	void InitVxPrintOffset(CDC* pDC);
    	...
    	friend class CAdvancedPreviewView;
    };
    

    Second I add some more zoom-in lebels to the MFC as following.

    #define ZOOM_IN_150     3
    #define ZOOM_IN_200     4
    #define ZOOM_IN_400     5
    

    I add some codes to such as SetScaleSize() function and others.

    Note

    You need to set a special path for "gafximpl.h" in your work space. The path must be set same as source path of MFC class library

    This is how you do this:

    • On the Project menu, click Settings.
    • In the Settings dialog box, select the C/C++ tab.
    • Select Preprocessor from the Category drop-down list.
    • The project-specific include paths are located in the Additional include directories edit box.

    Thank you.
    Yasuhiko Yoshimura
    September/05/2000

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    Share

    About the Author

    Yasuhiko Yoshimura
    Web Developer
    Japan Japan
    I have been programming for over 20 years and now run my own development company, Informax Inc., Osaka in Japan.
    Informax provides contract programming and engineering services. We can serve you with experiences in C++, DirectShow Filters, Shell Extension, MFC, ATL, WTL, STL, Boost, OTL, Windows2000 and XP, SymbianOS C++.
    Our speciality is the OOP and Design-Patterns solution throughout all entire project.

    Comments and Discussions

     
    GeneralTo activate Scroll Bar Pin
    vikas amin16-Sep-05 0:00
    membervikas amin16-Sep-05 0:00 
    GeneralRe: To activate Scroll Bar Pin
    vikas amin30-Sep-05 3:11
    membervikas amin30-Sep-05 3:11 
    GeneralVery Good But there was a probleme Pin
    hadjadj walid29-Aug-03 10:29
    memberhadjadj walid29-Aug-03 10:29 
    GeneralRe: Very Good But there was a probleme Pin
    Yasuhiko Yoshimura29-Aug-03 15:35
    memberYasuhiko Yoshimura29-Aug-03 15:35 
    GeneralRe: Very Good But there was a probleme Pin
    Anonymous9-Nov-03 9:24
    sussAnonymous9-Nov-03 9:24 
    Question"Shared DLL" is good. But "Static Library" ? Pin
    Anonymous29-Jul-01 22:25
    memberAnonymous29-Jul-01 22:25 
    AnswerRe: Pin
    Anonymous5-Aug-01 15:47
    memberAnonymous5-Aug-01 15:47 
    GeneralNot too good sample of programming Pin
    Alexander Fedorov16-Oct-00 10:55
    sussAlexander Fedorov16-Oct-00 10:55 
    GeneralRe: Not too good sample of programming Pin
    Slightly Bemused3-Dec-01 5:50
    memberSlightly Bemused3-Dec-01 5:50 
    GeneralHe has one good point Pin
    Tim Smith3-Dec-01 6:23
    memberTim Smith3-Dec-01 6:23 
    GeneralHe has one good point Pin
    Jörgen Sigvardsson26-Jun-05 10:52
    memberJörgen Sigvardsson26-Jun-05 10:52 
    GeneralNot compile : "afximpl.h" not found Pin
    KARIM MRIBTI14-Oct-00 3:39
    sussKARIM MRIBTI14-Oct-00 3:39 
    GeneralRe: Not compile : Pin
    anonymous14-Oct-00 3:45
    sussanonymous14-Oct-00 3:45 
    GeneralRe: Not compile : Pin
    anonymous14-Oct-00 3:45
    sussanonymous14-Oct-00 3:45 
    GeneralRe: Not compile : Pin
    anonymous14-Oct-00 3:46
    sussanonymous14-Oct-00 3:46 
    GeneralDownloads dont work -- Yelp!!! Pin
    kaykay14-Oct-00 0:21
    susskaykay14-Oct-00 0:21 
    GeneralRe: Downloads dont work -- Yelp!!! Pin
    Chris Maunder14-Oct-00 2:59
    sussChris Maunder14-Oct-00 2:59 
    GeneralBroken Links to downloads Pin
    Bill13-Oct-00 15:48
    sussBill13-Oct-00 15:48 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web04 | 2.8.150520.1 | Last Updated 13 Oct 2000
    Article Copyright 2000 by Yasuhiko Yoshimura
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid