SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
SftPrintPreview/DLL offers a built-in tool bar to allow the end-user to customize the current Print Preview.
The tool bar components offer ToolTip help when the mouse cursor rests over the item.
The tool bar and ToolTip text is customizable and can be translated into other languages (see National Language Support).
Some of the tool bar buttons can be hidden (see SFTPRINTPREVIEW_CONTROL, fWantCloseButton, fWantHelpButton and fWantPageSetupButton members), if they are not needed by an application.
The entire tool bar can be hidden using the SetControlInfo function (see SFTPRINTPREVIEW_CONTROL, fToolbar member), if an application wishes to implement its own tool bar. This may be desirable if achieving the same, consistent look across the entire application is necessary.
The Print Preview control by default allows the display of 1 through 64 pages at one time. The end-user can select the exact number of pages using the "Multiple Pages" button. By clicking on the drop down portion, a grid appears where the number of rows and pages per row can be selected. Some applications may want to limit the maximum number of pages, particularly if rendering the output can be time consuming. The maximum number of pages is defined using the SetControlInfo function (see SFTPRINTPREVIEW_CONTROL, maxPageRows and maxPageGroups members).
Input | Description |
Zoom Factor | Allows entry of a zoom factor value between 10 and up to the maximum defined using the SetControlInfo function (see SFTPRINTPREVIEW_CONTROL, maxZoom member). The default maximum value is 1000%. |
Zoom In | Increases the zoom factor by the value defined using the SetControlInfo function (see SFTPRINTPREVIEW_CONTROL, zoomIncrDecr member). The default value is 100%. If multiple pages are currently displayed, only the current page will be displayed, at the specified zoom factor. |
Zoom Out | Decreases the zoom factor by the value defined using the SetControlInfo function (see SFTPRINTPREVIEW_CONTROL, zoomIncrDecr member). The default value is 100%. If the resulting zoom factor is 0%, multiple pages are displayed. |
Single Page | Switches to single page mode, setting a zoom factor suitable to show the entire current page in the available display area. |
Multiple Pages | Clicking this button, will increase the currently displayed number of pages, going from one page to 1 x 2, 2 x 4, 3 x 6, 4 x 8, 5 x 10, 6 x 12, back to one page. |
Multiple Pages (Drop down button) | Displays a grid, allowing selection of the exact number of pages (rows and columns) to be displayed. |
Current Page | Allows entry of the selected page number. Page numbering starts at 1. |
Previous Page | Makes the previous page the new current page. |
Next Page | Makes the next page the new current page. |
Page Setup | The NM_SFTPRINTPREVIEW_PAGESETUP_CODE notification code is sent when the user clicks on the Page Setup button. The Page Setup dialog is not automatically invoked. |
Print Setup | The Print Setup dialog is automatically invoked. |
The Print dialog is automatically invoked. | |
Help | The NM_SFTPRINTPREVIEW_HELP_CODE notification code is sent when the user requests online help. |
Close Print Preview | The NM_SFTPRINTPREVIEW_CLOSE_CODE notification code is sent when the users requests to close the Print Preview control window. |
If Windows XP themes are enabled (see SFTPRINTPREVIEW_CONTROL, fUseThemes member) and available, the tool bar will be rendered using Windows themes and the user-defined background color (see SFTPRINTPREVIEW_COLORS, colorToolbar member) is ignored.
The control colors and button images cannot be customized. If detailed customization is required, an application can implement its own tool bar.
Most components of the tool bar automatically perform the desired action, such as zooming in/out, displaying the selected page(s), etc. A few components will generate events which must be handled by the application, so the application can respond to the requested action. The events generated by the "Page Setup", "Print" and "Help" buttons must be handled, otherwise these buttons have no effect.
Applications handle the following WM_NOTIFY messages:
The NM_SFTPRINTPREVIEW_CLOSE_CODE notification code is sent when the users requests to close the Print Preview control window.
Applications using C++/MFC and the CSftPrintPreview_View class do not need to handle this notification as it is automatically handled by the CSftPrintPreview_View class.
The NM_SFTPRINTPREVIEW_HELP_CODE notification code is sent when the user requests online help.
The NM_SFTPRINTPREVIEW_PAGESETUP_CODE notification code is sent when the user requests the Page Setup dialog.
Applications using C++/MFC and the CSftPrintPreview_View class do not need to handle this notification as it is automatically handled by the CSftPrintPreview_View class.
The SFTPRINTPREVIEWN_STARTPRINTING notification code is sent when the user requests printing of the current contents.
Applications using C++/MFC and the CSftPrintPreview_View class do not need to handle this notification as it is automatically handled by the CSftPrintPreview_View class.
C
LRESULT CALLBACK MainWindowProc(HWND hwndMain, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_NOTIFY: { int id = (int) wParam; LPNMHDR pnmh = (LPNMHDR) lParam; switch (id) { case IDC_PREVIEW: switch (pnmh->code) { case NM_SFTPRINTPREVIEW_CLOSE_CODE: { // user wants to close NM_SFTPRINTPREVIEW_CLOSE* pNtfy = (NM_SFTPRINTPREVIEW_CLOSE*) lParam; SendMessage(hwndMain, WM_CLOSE, 0, 0); break; } case NM_SFTPRINTPREVIEW_HELP_CODE: { // help requested NM_SFTPRINTPREVIEW_HELP* pNtfy = (NM_SFTPRINTPREVIEW_HELP*) lParam; MessageBox(hwndMain, TEXT("Sorry, this sample application doesn't include online help."), TEXT("SftPrintPreview/DLL"), MB_OK); break; } case NM_SFTPRINTPREVIEW_PAGESETUP_CODE: { // Page setup requested SftPrintPreview_PageSetup(m_hwndPreview, hwndMain); break; } } break; } break; } case WM_COMMAND: { HWND hwndCtl = (HWND) lParam; int id = LOWORD(wParam); int code = HIWORD(wParam); if (hwndCtl) { switch (id) { case IDC_PREVIEW: switch (code) { case SFTPRINTPREVIEWN_STARTPRINTING: SftPrintPreview_Print(hwndCtl, hwndMain); break; } break; } } break; } } return DefWindowProc(hwndMain, uMsg, wParam, lParam); }
C++
BEGIN_MESSAGE_MAP(CPreviewPagePrinting, CSftPrintPreview_View) ON_NM_SFTPRINTPREVIEW_HELP_CODE_REFLECT(OnNotifyHelpReflect) END_MESSAGE_MAP() afx_msg void CPreviewPagePrinting::OnNotifyHelpReflect(NMHDR * pNotifyStruct, LRESULT* lResult) { MessageBox(_T("Sorry, this sample application doesn't include online help."), _T("SftPrintPreview/DLL"), MB_OK); *lResult = 0; }