|
|
|
CheckMarginsPrintable |
The CheckMarginsPrintable function returns whether the specified margins are within the printer's printable area.
C
BOOL WINAPI SftPrintPreview_CheckMarginsPrintable(HWND hwndCtl, BOOL fMsg, BOOL* fUpdated, double* Left, double* Top, double* Right, double* Bottom, double* HeaderDist, double* FooterDist);
C++
BOOL CSftPrintPreview::CheckMarginsPrintable(BOOL fMsg, BOOL* fUpdated, double* Left, double* Top, double* Right, double* Bottom, double* HeaderDist, double* FooterDist) const;
Parameters
hwndCtl
The window handle of the Print Preview control.
fMsg
Set to TRUE to display a suitable error message if the specified margins are invalid, FALSE otherwise. The error message is localized based on the supplied resources (see National Language Support).
fUpdated
Returns non-zero if any of the margin values has been updated, because it was invalid, otherwise 0 is returned. The actual value return depends on the invalid argument (1=Top, 2=Bottom, 3=Left, 4=Right, 5=HeaderDist, 6=FooterDist).
Left, Top, Right, Bottom, HeaderDist, FooterDist
On entry, specifies the margins requested. On return, the values are adjusted if outside of the printable area, along with a suitable error message (based on fMsg) and feedback (fUpdated).
Returns
The return value is TRUE if all margin values are within the printable area, FALSE otherwise.
Comments
The CheckMarginsPrintable function returns whether the specified margins are within the printer's printable area.\
The CheckMarginsPrintable function is identical to the CheckMarginsPrintableExternal function, but doesn't require a SftPrintPreview control to be active. This allows an application to manipulate the current/selected printer margins before the first SftPrintPreview control is created.
Example
C
BOOL fUpdated; double left = 0.1, right = 0.1, top = 0.1, bottom = 0.1, hdr = 0.1, footer = 0.1; if (SftPrintPreview_CheckMarginsPrintable(m_hwndPreview, TRUE, &fUpdated, &left, &right, &top, &bottom, &hdr, &footer)) ; // Margins are OK
C++
BOOL fUpdated; double left = 0.1, right = 0.1, top = 0.1, bottom = 0.1, hdr = 0.1, footer = 0.1; if (CSftPrintPreview::CheckMarginsPrintable(TRUE, &fUpdated, &left, &right, &top, &bottom, &hdr, &footer)) ; // Margins are OK
See Also C/C++ API | C++ Classes | Notifications