Hide

SftPrintPreview/OCX 1.0 - ActiveX Print Preview Control

Display
Print

SftPrintPreview.ContentProviderCallback Method

Defines the callback that provides printable content.

Syntax

VB.NETobject.ContentProviderCallback(ByVal Handle As Integer, ByVal CallbackPointer As VT_VOID, ByVal WorkAreaPointer As VT_VOID)
VBobject.ContentProviderCallback(ByVal Handle As Long, CallbackPointer As VT_VOID, WorkAreaPointer As VT_VOID)
C#.NETvoid object.ContentProviderCallback(int Handle, void CallbackPointer, void WorkAreaPointer);
VC++HRESULT object->ContentProviderCallback(long Handle, void* CallbackPointer, void* WorkAreaPointer);
CHRESULT object->raw_ContentProviderCallback(long Handle, void* CallbackPointer, void* WorkAreaPointer);

object

A SftPrintPreview object.

Handle

A window handle describing the window to be printed or previewed. This value can be 0 if application-generated output is rendered using the RenderContent event.

CallbackPointer

A callback routine. This value can be 0 (NULL) if application-generated output is rendered using the RenderContent event. When rendering a RichEdit control, Handle defines the RichEdit control and CallbackPointer is set to the RenderRichEdit or RenderRichEditX property value to print and preview the RichEdit control. This CallbackPointer is of type SFTPRINTPREVIEW_DRAWINFOPROC, which is defined by SftPrintPreview/DLL and can be used to implement a callback function as required by SftPrintPreview/DLL (requires SftPrintPreview/DLL).

WorkAreaPointer

An application-defined value. This value is available during the RenderContent event using the RenderingWorkArea property.

Comments

The ContentProviderCallback method defines the callback that provides printable content.

This method is not supported for use with Visual Basic 6.0

The use of the ContentProviderCallback or ContentProviderCallbackX methods override settings defined using a prior call to the ContentProvider property.

The ContentProviderCallback or ContentProviderCallbackX methods are functionally equivalent, but use different data types.

RichEdit controls require the use of the RenderRichEdit or RenderRichEditX functions as a CallbackPointer for the ContentProviderCallback or ContentProviderCallbackX methods. The ContentProvider property is not used. The RenderRichEdit function, provided by SftPrintPreview/OCX, provides all rendering support for RichEdit controls. The RenderContent event is not used.

For application-generated output, the ContentProviderCallback or ContentProviderCallbackX methods are used with a CallbackPointer value of 0. The RenderContent event is used to render pages. The ContentProvider property is not used

SftTree/DLL and SftTree/OCX 5.0 (and up) are rendered by setting the ContentProvider property to the window handle of a SftTree/DLL or SftTree/OCX control. The ContentProviderCallback or ContentProviderCallbackX methods are not used. The DataProvider property is also supported for use with SftTree/DLL or SftTree/OCX controls. All rendering is provided by SftTree/DLL or SftTree/OCX through the SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE protocol. The RenderContent event is not used.

Examples

VB.NET

Private Sub MenuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuExit.Click
    Application.Exit()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftPrintPreview1.Dock = DockStyle.Fill

    ' Use the RenderContent event to render pages
    AxSftPrintPreview1.ContentProviderCallback(0, IntPtr.Zero, IntPtr.Zero)

    Show() ' Show this form so we get the form and the messagebox at the same time

    MessageBox.Show("This example demonstrates application-generated output." & vbCr & vbLf & vbCr & vbLf & "It prints one bitmap and 50 lines of text a total of 20 times.  " & _
        "The included source code illustrates how an application can print one page at a time, with an easy " & _
        "mechanism to keep track of restart positions.")
End Sub

C#

    Application.Exit();
}

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftPrintPreview1.Dock = DockStyle.Fill;

    // Use the RenderContent event to render pages
    axSftPrintPreview1.ContentProviderCallback(0, IntPtr.Zero, IntPtr.Zero);

    Show(); // Show this form so we get the form and the messagebox at the same time

    MessageBox.Show("This example demonstrates application-generated output.\r\n\r\nIt prints one bitmap and 50 lines of text a total of 20 times.  " +
        "The included source code illustrates how an application can print one page at a time, with an easy " +
        "mechanism to keep track of restart positions.");
}

C++

    CRect rect;
    GetClientRect(&rect);
    m_Preview1.MoveWindow(0, 0, rect.Width(), rect.Height());

    m_vPrintPreview1 = m_Preview1.GetControlUnknown();
    ASSERT(m_vPrintPreview1 != NULL);

    // Use the RenderContent event to render pages
    m_vPrintPreview1->ContentProviderCallback(0, NULL, NULL);

    ShowWindow(SW_MAXIMIZE);
    UpdateWindow();

    MessageBox(_T("This example demonstrates application-generated output.\r\n\r\nIt prints one bitmap and 50 lines of text a total of 20 times.  "
        "The included source code illustrates how an application can print one page at a time, with an easy "
        "mechanism to keep track of restart positions."), _T("SftPrintPreview/OCX"));

See Also SftPrintPreview Object | Object Hierarchy


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