Hide

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

Display
Print

RichEdit Control

SftPrintPreview/DLL has built-in support for the standard Windows RichEdit control, also known as RichTextBox control, allowing print preview and printing of its contents.

The PreviewRichEdit sample demonstrates how a RichEdit control is used with SftPrintPreview/DLL. The source code for this sample is included for both C and C++/MFC and is available in the product directory \Program Files\Softelvdm\SftPrintPreview DLL 2.0\Samples.

The contents of the RichEdit control are displayed across the full width of the page, with all formatting defined using the RichEdit control's API functions. The iContentSizing member of the SFTPRINTPREVIEW_CONTROL structure has no effect, when previewing/printing a RichEdit control.

When previewing/printing a RichEdit control, only TrueType or ClearType fonts should be used, to insure proper scaling and resizing of all generated output.

Example

C

SFTPRINTPREVIEW_CONTROL Ctl;

Ctl.cbSize = sizeof(SFTPRINTPREVIEW_CONTROL);
if (!SftPrintPreview_GetControlInfo(hwndCtl, &Ctl))
    _ASSERT(0); // error handling

// define desired contents to preview/print
Ctl.lpDrawPageWorkArea = (SFTPRINTPREVIEW_DWORD_PTR) NULL;
Ctl.lpDrawInfoProc = SftPrintPreview_RenderRicheditWindow_Callback;
Ctl.hwndContent = hwndRichEdit; // the RichEdit control window
Ctl.hwndData = NULL; // no data window (content window is data window)

if (!SftPrintPreview_SetControlInfo(hwndCtl, &Ctl)) {
    int errorValue = Ctl.errorValue;
    _ASSERT(0); // an error occurred, check errorValue for error codes
}

C++

afx_msg void OnFilePrintPreview()
{
    FilePrintPreview(this, RUNTIME_CLASS(CRichEditPreview), m_RichEdit.m_hWnd,
    SftPrintPreview_RenderRicheditWindow_Callback);
}

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