Hide

SftPrintPreview/OCX 1.0 - ActiveX Print Preview Control

Display
Print

SftPrintPreview.PrintContents Method

Start printing.

Syntax

VB.NETobject.PrintContents(ByVal ShowDialog As Boolean, ByVal Handle As Integer, ByVal AllowCurrentPage As Boolean)
VBobject.PrintContents(ByVal ShowDialog As Boolean, ByVal Handle As Long, ByVal AllowCurrentPage As Boolean)
C#.NETvoid object.PrintContents(bool ShowDialog, int Handle, bool AllowCurrentPage);
VC++HRESULT object->PrintContents(VARIANT_BOOL ShowDialog, long Handle, VARIANT_BOOL AllowCurrentPage);
CHRESULT object->raw_PrintContents(VARIANT_BOOL ShowDialog, long Handle, VARIANT_BOOL AllowCurrentPage);

object

A SftPrintPreview object.

ShowDialog

True to display the Print dialog before printing, False otherwise.

Handle

The window handle of the application's main window, which serves as the parent window for the Print dialog. If 0 is specified, the application's main window is determined automatically.

AllowCurrentPage

True to enable the "Current Page" radio button on the Print dialog, False otherwise. The Print dialog on Windows versions before Windows 2000 does not offer a current page radio button.

Comments

The PrintContents method starts printing.

If the user modifies printer settings before printing, the PrinterChanged even occurs.

The PrintPages property can be used to define the pages to print using the PrintContents method.

Examples

VB.NET

    MessageBox.Show("Sorry, this sample doesn't offer a help file")
End Sub

Private Sub AxSftPrintPreview1_CloseWanted(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftPrintPreview1.CloseWanted
    MenuViewRichEdit_Click(Me, New System.EventArgs())
End Sub

Private Sub MenuPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuPrint.Click
    AxSftPrintPreview1.PrintContents(True, 0, False)
End Sub

Private Sub MenuPrintSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuPrintSetup.Click
    AxSftPrintPreview1.PrinterSetup(0)
End Sub

VB6

    SftPrintPreview1.Visible = False
    ' Show the RichEdit control
    RichTextBox1.Enabled = True
    RichTextBox1.Visible = True
    RichTextBox1.SetFocus
End Sub

Private Sub PrintDirect_Click()
    SftPrintPreview1.PrintContents True, 0, False
End Sub

Private Sub PrintSetup_Click()
    SftPrintPreview1.PrinterSetup 0
End Sub

C#

private void axSftPrintPreview1_CloseWanted(object sender, System.EventArgs e)
{
    menuViewRichEdit_Click(this, new System.EventArgs());
}

private void menuPrint_Click(object sender, System.EventArgs e)
{
    axSftPrintPreview1.PrintContents(true, 0, false);
}

private void menuprintSetup_Click(object sender, System.EventArgs e)
{
    axSftPrintPreview1.PrinterSetup(0);
}

See Also SftPrintPreview Object | Object Hierarchy


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