Print Preview Enhancements

New users of this class will have to visit Robin's article for the relevant download material and then update the .cpp/.h files with the versions provided in this article. Old users of the class can just replace their existing .cpp/.h files with these.

Overview of New Functionality

This is an update of the nice class provided in Robin's article and includes the following features:
  • The print preview will now never show empty preview pages unless the user views 2 pages of output when only 1 is available.
  • Print preview will now respond to WM_MOUSEWHEEL messages appropriately. In "zoom out" mode, it will scroll you through the pages of output. In "zoom in" mode, it will scroll the output page up/down.

Implementation Details

For the mouse wheel to work correctly, you will have to override your CMainFrame::PreTranslateMessage() function as follows:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
{
 // TODO: Add your specialized code here and/or call the base class
 if (pMsg->message == WM_MOUSEWHEEL)
 {
  CView *pView = GetActiveView() ;
  if (pView != NULL)
   pView->SendMessage(WM_MOUSEWHEEL, pMsg->wParam, pMsg->lParam) ;
 }

 // call the base class here
}
This is required because in print preview mode, the WM_MOUSEWHEEL messages go to the CDialogBar in the window and not directly to the view. This was the only way I could find of easily getting these messages to the CMyPreviewView window.

Downloads

Download source - 6 Kb


About the Author

Roger Allen

Its me!

Comments

  • Article no longer updated

    Posted by Legacy on 12/06/2002 12:00am

    Originally posted by: Roger Allen

    If your interested in this or any other printing article, I maintain my printing articles over on codeproject.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 23, 2014 @ 12:00 p.m. ET / 9:00 a.m. PT Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this eSeminar to learn why physical appliances are preferable to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds