Hide

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

Display
Print

CheckMarginsPrintableExternal Function

The CheckMarginsPrintableExternal function returns whether the specified margins are within the printer's printable area.

C

BOOL SftPrintPreview_CheckMarginsPrintableExternal(SFTPRINTPREVIEW_PRINTERRESULT * Prt,
    BOOL fMsg, BOOL* fUpdated,
    double* Left, double* Top, double* Right, double* Bottom,
    double* HeaderDist, double* FooterDist);

C++

static BOOL CSftPrintPreview::CheckMarginsPrintableExternal(SFTPRINTPREVIEW_PRINTERRESULT * lpPrt,
    BOOL fMsg, BOOL* fUpdated,
    double* Left, double* Top, double* Right, double* Bottom,
    double* HeaderDist, double* FooterDist);

Parameters

Prt

The printer definitions.

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 CheckMarginsPrintableExternal 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

SFTPRINTPREVIEW_PRINTERRESULT Prt;
BOOL fDefault;
memset(&Prt, 0, sizeof(Prt));
if (SftPrintPreview_PrintSetupExternal(&Prt, &fDefault, hwndMain)) {
    BOOL fUpdated;
    double left = 0.1, right = 0.1, top = 0.1, bottom = 0.1, hdr = 0.1, footer = 0.1;
    if (SftPrintPreview_CheckMarginsPrintableExternal(&Prt, TRUE, &fUpdated, &left, &right, &top, &bottom, &hdr, &footer))
        ; // Margins are OK
}

C++

SFTPRINTPREVIEW_PRINTERRESULT Prt;
BOOL fDefault;
memset(&Prt, 0, sizeof(Prt));
if (CSftPrintPreview::PrintSetupExternal(Prt, fDefault, NULL)) {
    BOOL fUpdated;
    double left = 0.1, right = 0.1, top = 0.1, bottom = 0.1, hdr = 0.1, footer = 0.1;
    if (CSftPrintPreview::CheckMarginsPrintableExternal(&Prt, TRUE, &fUpdated, &left, &right, &top, &bottom, &hdr, &footer))
        ; // Margins are OK
}

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


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