|
|
|
PageSetup |
The PageSetup function invokes the built-in Page Setup dialog, used to define the page layout (margins, headers, etc.).
C
BOOL SftPrintPreview_PageSetup(HWND hwnd, HWND hwndDialog);
C++
BOOL CSftPrintPreview::PageSetup(HWND hwndDialog = NULL);
Parameters
hwnd
The window handle of the Print Preview control.
hwndDialog
The window handle of the application's main window, which serves as the parent window for the Page Setup dialog. If NULL is specified, the application's main window is determined automatically.
Returns
The return value is TRUE if the function was successful, FALSE otherwise. If the user cancels the dialog, FALSE is returned.
Comments
The PageSetup function invokes the built-in Page Setup dialog, used to define the page layout (margins, headers, etc.).
The NM_SFTPRINTPREVIEW_PAGESETUPCHANGED_CODE notification code is sent when the user has modified the page layout using the Page Setup dialog.
Example
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_PAGESETUP_CODE: SftPrintPreview_PageSetup(m_hwndPreview, hwndMain); break; } break; } break; } } return DefWindowProc(hwndMain, uMsg, wParam, lParam); }
C++
BEGIN_MESSAGE_MAP(CPreviewDialog, CDialog) ON_NM_SFTPRINTPREVIEW_PAGESETUP_CODE(IDC_PREVIEW, OnPreviewPageSetup) END_MESSAGE_MAP()
afx_msg void CPreviewDialog::OnPreviewPageSetup(NMHDR* pnmh, LRESULT* result) { NM_SFTPRINTPREVIEW_PAGESETUP* pNotifyStruct = (NM_SFTPRINTPREVIEW_PAGESETUP*) pnmh; SftPrintPreview_PageSetup(m_Preview, m_hWnd); }
See Also C/C++ API | C++ Classes | Notifications