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
The SFTPRINTPREVIEW_CUSTOMVAR structure is used to describe a variable name used for string substitution in headers and footers.
typedef struct tagSftPrintPreviewCustomVar { LPCTSTR lpszVarName; // variable name (without lead-in) LPCTSTR lpszText; // new text to be substituted } SFTPRINTPREVIEW_CUSTOMVAR, * LPSFTPRINTPREVIEW_CUSTOMVAR; typedef const SFTPRINTPREVIEW_CUSTOMVAR * LPCSFTPRINTPREVIEW_CUSTOMVAR;
The variable name. Leading/trailing % characters must not be included.
The text to be substituted for the variable.
The SFTPRINTPREVIEW_CUSTOMVAR structure is used to describe a variable name used for string substitution in headers and footers.
An application can provide a table of custom string substitution variables for the headers/footers. Each entry in the table consists of a SFTPRINTPREVIEW_CUSTOMVAR structure describing one variable.
The table is defined using SFTPRINTPREVIEW_CONTROL, lpCustomVars.
C
static SFTPRINTPREVIEW_CUSTOMVAR customVariables[] = { { "MyVar1", "Text substituted for MyVar1", }, { "MyVar2", "Text substituted for the other variable", }, { NULL, NULL }, }; // retrieve current control settings SFTPRINTPREVIEW_CONTROL Ctl; Ctl.cbSize = sizeof(SFTPRINTPREVIEW_CONTROL); if (!SftPrintPreview_GetControlInfo(hwndCtl, &Ctl)) { _ASSERT(0); // the SFTPRINTPREVIEW_CONTROL structure's cbSize member wasn't initialized properly return; } // set all desired options Ctl.numPageRows = 1; // default to 1x2 pages Ctl.numPageGroups = 2; Ctl.zoom = 0; // start out with multiple pages lstrcpy(Ctl.szOutputName, TEXT("Sample Output")); // job name when printing lstrcpy(Ctl.szHeaderRight, TEXT("Header %MyVar1% <-variable")); lstrcpy(Ctl.szFooterLeft, TEXT("Here we use %MyVar2%")); Ctl.lpCustomVars = customVariables; Ctl.fCenterOnClick = FALSE; Ctl.fDragPage = TRUE; Ctl.iZoomStyle = SFTPRINTPREVIEW_ZOOMSTYLE_BOTHBUTTONS_EXACT; if (!SftPrintPreview_SetControlInfo(hwndCtl, &Ctl)) { int errorValue = Ctl.errorValue; _ASSERT(0); // an error occurred, check errorValue for error code return; }
C++
void CPreviewPagePrinting::CustomizeControl(LPSFTPRINTPREVIEW_CONTROL lpCtl) { static SFTPRINTPREVIEW_CUSTOMVAR customVariables[] = { { "MyVar1", "Text substituted for MyVar1", }, { "MyVar2", "Text substituted for the other variable", }, { NULL, NULL }, }; lpCtl->numPageRows = 1; // default to 1x2 pages lpCtl->numPageGroups = 2; lpCtl->zoom = 0; // start out with multiple pages lpCtl->fCenterOnClick = FALSE; lpCtl->fDragPage = TRUE; lpCtl->iZoomStyle = SFTPRINTPREVIEW_ZOOMSTYLE_BOTHBUTTONS_EXACT; lstrcpy(lpCtl->szHeaderRight, TEXT("Header %MyVar1% <-variable")); lstrcpy(lpCtl->szFooterLeft, TEXT("Here we use %MyVar2%")); lpCtl->lpCustomVars = customVariables; }
See Also C/C++ API | C++ Classes | Notifications