Hide

SftPrintPreview/DLL 2.0 - Print Preview Control for C/C++

Display
Print

CSftPrintPreview_View::On... Functions/Menu Handlers

SftPrintPreview/DLL offers a collection of menu command handlers, implementing user actions affecting the preview display.

C++

afx_msg void CSftPrintPreview_View::OnFilePrint();
afx_msg void CSftPrintPreview_View::OnFilePrintSetup();
afx_msg void CSftPrintPreview_View::OnFilePrintWithDialog();
afx_msg void CSftPrintPreview_View::OnPreviewClose();
afx_msg void CSftPrintPreview_View::OnPreviewNextPage();
afx_msg void CSftPrintPreview_View::OnPreviewNextPage_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnPreviewPageSetup();
afx_msg void CSftPrintPreview_View::OnPreviewPageSetup_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnPreviewPrevPage();
afx_msg void CSftPrintPreview_View::OnPreviewPrevPage_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnPreviewZoomEdit();
afx_msg void CSftPrintPreview_View::OnPreviewZoomEdit_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnPreviewZoomIn();
afx_msg void CSftPrintPreview_View::OnPreviewZoomIn_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnPreviewZoomOut();
afx_msg void CSftPrintPreview_View::OnPreviewZoomOut_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnStartPrinting();
afx_msg void CSftPrintPreview_View::OnViewPageEdit();
afx_msg void CSftPrintPreview_View::OnViewPageEdit_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages1x2();
afx_msg void CSftPrintPreview_View::OnViewPages1x2_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages2x4();
afx_msg void CSftPrintPreview_View::OnViewPages2x4_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages3x6();
afx_msg void CSftPrintPreview_View::OnViewPages3x6_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages4x8();
afx_msg void CSftPrintPreview_View::OnViewPages4x8_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages5x10();
afx_msg void CSftPrintPreview_View::OnViewPages5x10_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewPages6x12();
afx_msg void CSftPrintPreview_View::OnViewPages6x12_UpdateUI(CCmdUI* pCmdUI);
afx_msg void CSftPrintPreview_View::OnViewSinglePage();
afx_msg void CSftPrintPreview_View::OnViewSinglePage_UpdateUI(CCmdUI* pCmdUI);

Parameters

pNotifyStruct

A pointer to a NMHDR structure, containing additional information about the notification.

result

A pointer to a LRESULT, where return information is stored. This value is not used by SftPrintPreview/DLL.

pCmdUI

A pointer to a CCmdUI object, to be updated by the command handler with desired menu attributes. CCmdUI is an MFC-defined class and is documented in the Microsoft Foundation Class and Templates documentation included with Visual C++/Visual Studio .NET.

Comments

SftPrintPreview/DLL offers a collection of menu command handlers, implementing user actions affecting the preview display:

FunctionDescription
OnFilePrintInvokes the Print function.
OnFilePrintSetupInvokes the PrintSetup function.
OnFilePrintWithDialogInvokes the PrintDialog function.
OnPreviewCloseCloses the Print Preview window.
OnPreviewNextPageMakes the next page the current page.
OnPreviewNextPage_UpdateUIUpdates pCmdUI with information about the OnPreviewNextPage menu command's current status.
OnPreviewPageSetupInvokes the PageSetup function.
OnPreviewPageSetup_UpdateUIUpdates pCmdUI with information about the OnPreviewPageSetup menu command's current status.
OnPreviewPrevPageMakes the previous page the current page.
OnPreviewPrevPage_UpdateUIUpdates pCmdUI with information about the OnPreviewPrevPage menu command's current status.
OnPreviewZoomEditInvokes the ToolBarEdit function to set the input focus the combo box used to enter the zoom factor.
OnPreviewZoomEdit_UpdateUIUpdates pCmdUI with information about the OnPreviewZoomEdit menu command's current status.
OnPreviewZoomInIncreases the zoom factor by 100%.
OnPreviewZoomIn_UpdateUIUpdates pCmdUI with information about the OnPreviewZoomIn menu command's current status.
OnPreviewZoomOutDecreases the zoom factor by 100%. If the zoom factor becomes 0, the display returns to a multi-page preview.
OnPreviewZoomOut_UpdateUIUpdates pCmdUI with information about the OnPreviewZoomOut menu command's current status.
OnStartPrintingStarts printing.
OnViewPageEditInvokes the ToolBarEdit function to set the input focus the edit control used to enter the current page number.
OnViewPageEdit_UpdateUIUpdates pCmdUI with information about the OnViewPageEdit menu command's current status.
OnViewPages1x2Invokes a 1 x 2 multi-page view.
OnViewPages1x2_UpdateUIUpdates pCmdUI with information about the OnViewPages1x2 menu command's current status.
OnViewPages2x4Invokes a 2 x 4 multi-page view.
OnViewPages2x4_UpdateUIUpdates pCmdUI with information about the OnViewPages2x4 menu command's current status.
OnViewPages3x6Invokes a 3 x 6 multi-page view.
OnViewPages3x6_UpdateUIUpdates pCmdUI with information about the OnViewPages3x6 menu command's current status.
OnViewPages4x8Invokes a 4 x 8 multi-page view.
OnViewPages4x8_UpdateUIUpdates pCmdUI with information about the OnViewPages4x8 menu command's current status.
OnViewPages5x10Invokes a 5 x 10 multi-page view.
OnViewPages5x10_UpdateUIUpdates pCmdUI with information about the OnViewPages5x10 menu command's current status.
OnViewPages6x12Invokes a 6 x 12 multi-page view.
OnViewPages6x12_UpdateUIUpdates pCmdUI with information about the OnViewPages6x12 menu command's current status.
OnViewSinglePageDisplays the current page in single page mode at 100% zoom factor.
OnViewSinglePage_UpdateUIUpdates pCmdUI with information about the OnViewSinglePage menu command's current status.

Example

C++

TreePreview.h

class CTreePreview : public CSftPrintPreview_View
{
public:
    virtual CString GetOutputName() { return _T("SftPrintPreview PreviewSftTree Sample Output"); }

    virtual void CustomizeControl(LPSFTPRINTPREVIEW_CONTROL lpCtl);

    virtual LPCTSTR GetMenuResourceID() { return MAKEINTRESOURCE(IDR_PREVIEW); }
    virtual LPCTSTR GetAccelResourceID() { return MAKEINTRESOURCE(IDR_PRINTPREVIEW); }

    afx_msg void OnNotifyHelpReflect(NMHDR * pNotifyStruct, LRESULT* result);

    DECLARE_MESSAGE_MAP()
    DECLARE_DYNCREATE(CTreePreview)
};

TreePreview.cpp

IMPLEMENT_DYNCREATE(CTreePreview, CSftPrintPreview_View)

BEGIN_MESSAGE_MAP(CTreePreview, CSftPrintPreview_View)
    ON_COMMAND(ID_FILE_PRINT, OnFilePrintWithDialog)
    ON_COMMAND(ID_FILE_PRINT_SETUP, OnFilePrintSetup)
    ON_COMMAND(ID_FILE_CLOSE, OnPreviewClose)
    ON_UPDATE_COMMAND_UI(ID_EDIT_PAGESETUP, OnPreviewPageSetup_UpdateUI)
    ON_COMMAND(ID_EDIT_PAGESETUP, OnPreviewPageSetup)
    ON_UPDATE_COMMAND_UI(ID_ZOOM_IN, OnPreviewZoomIn_UpdateUI)
    ON_COMMAND(ID_ZOOM_IN, OnPreviewZoomIn)
    ON_UPDATE_COMMAND_UI(ID_ZOOM_OUT, OnPreviewZoomOut_UpdateUI)
    ON_COMMAND(ID_ZOOM_OUT, OnPreviewZoomOut)
    ON_UPDATE_COMMAND_UI(ID_ZOOM_EDIT, OnPreviewZoomEdit_UpdateUI)
    ON_COMMAND(ID_ZOOM_EDIT, OnPreviewZoomEdit)
    ON_UPDATE_COMMAND_UI(ID_VIEW_NEXTPAGE, OnPreviewNextPage_UpdateUI)
    ON_COMMAND(ID_VIEW_NEXTPAGE, OnPreviewNextPage)
    ON_UPDATE_COMMAND_UI(ID_VIEW_PREVPAGE, OnPreviewPrevPage_UpdateUI)
    ON_COMMAND(ID_VIEW_PREVPAGE, OnPreviewPrevPage)
    ON_UPDATE_COMMAND_UI(ID_VIEW_SINGLEPAGE, OnViewSinglePage_UpdateUI)
    ON_COMMAND(ID_VIEW_SINGLEPAGE, OnViewSinglePage)
    ON_UPDATE_COMMAND_UI(ID_VIEW_1x2, OnViewPages1x2_UpdateUI)
    ON_COMMAND(ID_VIEW_1x2, OnViewPages1x2)
    ON_UPDATE_COMMAND_UI(ID_VIEW_2x4, OnViewPages2x4_UpdateUI)
    ON_COMMAND(ID_VIEW_2x4, OnViewPages2x4)
    ON_UPDATE_COMMAND_UI(ID_VIEW_3x6, OnViewPages3x6_UpdateUI)
    ON_COMMAND(ID_VIEW_3x6, OnViewPages3x6)
    ON_UPDATE_COMMAND_UI(ID_VIEW_4x8, OnViewPages4x8_UpdateUI)
    ON_COMMAND(ID_VIEW_4x8, OnViewPages4x8)
    ON_UPDATE_COMMAND_UI(ID_VIEW_5x10, OnViewPages5x10_UpdateUI)
    ON_COMMAND(ID_VIEW_5x10, OnViewPages5x10)
    ON_UPDATE_COMMAND_UI(ID_VIEW_6x12, OnViewPages6x12_UpdateUI)
    ON_COMMAND(ID_VIEW_6x12, OnViewPages6x12)
    ON_UPDATE_COMMAND_UI(ID_VIEW_PAGE, OnViewPageEdit_UpdateUI)
    ON_COMMAND(ID_VIEW_PAGE, OnViewPageEdit)
    ON_NM_SFTPRINTPREVIEW_HELP_CODE_REFLECT(OnNotifyHelpReflect)
END_MESSAGE_MAP()

afx_msg void CTreePreview::OnNotifyHelpReflect(NMHDR * pNotifyStruct, LRESULT* lResult)
{
    MessageBox(_T("Sorry, this sample application doesn't include online help."),
    _T("SftPrintPreview/DLL"), MB_OK);
    *lResult = 0;
}

void CTreePreview::CustomizeControl(LPSFTPRINTPREVIEW_CONTROL lpCtl)
{
    lpCtl->numPageRows = 1; // default to 1x2 pages
    lpCtl->numPageGroups = 2;
    lpCtl->zoom = 0; // start out with multiple pages

    lstrcpy(lpCtl->szHeaderRight, TEXT("SftPrintPreview/DLL PreviewSftTree Sample"));
    lstrcpy(lpCtl->szFooterLeft, TEXT("www.softelvdm.com"));
}

See Also C/C++ API | C++ Classes | Notifications


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.