Hide

SftPrintPreview/OCX 1.0 - ActiveX Print Preview Control

Display
Print

SftPrintPreview.Restart Method

Forces the repositioning of all preview pages and clearing of any cached information.

Syntax

VB.NETobject.Restart(ByVal Style As SftPrintPreviewRestartConstants)
VBobject.Restart(ByVal Style As SftPrintPreviewRestartConstants)
C#.NETvoid object.Restart(SftPrintPreviewRestartConstants Style);
VC++HRESULT object->Restart(enum SftPrintPreviewRestartConstants Style);
CHRESULT object->raw_Restart(enum SftPrintPreviewRestartConstants Style);

object

A SftPrintPreview object.

Style

Defines the type of repositioning and clearing of cached information.

NameValueDescription
restartSftPrintPreviewComplete0Complete - Repositions all pages, all pages are invalid and clears all cached information.
restartSftPrintPreviewTop1Top - Repositions all pages and displays the first page.
restartSftPrintPreviewBottom2Bottom - Repositions all pages and displays the last page.
restartSftPrintPreviewCurrentPage3Current Page - The current page is invalid and clears cached information for the current page.
restartSftPrintPreviewAllPages4All Pages - All pages are invalid and clears all cached information.

Comments

The Restart method forces the repositioning of all preview pages and clearing of any cached information.

This method is typically used if printer attributes or page formatting change, which requires all pages to be reformatted.

Examples

VB6

    ' Hide the RichEdit control
    RichTextBox1.Enabled = False
    RichTextBox1.Visible = False
    ' Show the print preview control
    SftPrintPreview1.Enabled = True
    SftPrintPreview1.Visible = True
    SftPrintPreview1.SetFocus
    ' In case the tree control changed, we have to reformat everything
    SftPrintPreview1.Restart restartSftPrintPreviewComplete
End Sub

Private Sub ViewRichEdit_Click()
    ' Hide the print preview control
    SftPrintPreview1.Enabled = False
    SftPrintPreview1.Visible = False
    ' Show the RichEdit control

C#

    richTextBox1.Enabled = false;
    // Show the print preview control
    axSftPrintPreview1.Enabled = true;
    axSftPrintPreview1.Visible = true;
    axSftPrintPreview1.Focus();
    axSftPrintPreview1.Width = this.Width;
    axSftPrintPreview1.Height = this.Height;
    // In case the richedit control changed, we have to reformat everything
    axSftPrintPreview1.Restart(SftPrintPreviewRestartConstants.restartSftPrintPreviewComplete);
}

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

C++

    ASSERT(m_vPrintPreview1 != NULL);

    // Load contents
    m_Edit.LimitText(0x7fffffff);//need all the space we can get
    LoadEditControlWithFile(CString(_T("..\\SftPrintPreview.rtf")));

    // Connect the richedit control to the print preview control
    m_vPrintPreview1->ContentProviderCallback((long) m_Edit.m_hWnd, m_vPrintPreview1->RenderRichEdit, NULL);
    m_vPrintPreview1->Restart(restartSftPrintPreviewComplete);

    ShowWindow(SW_MAXIMIZE);

    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CSftPrintPreviewDlg::OnSize(UINT nType, int cx, int cy)

See Also SftPrintPreview Object | Object Hierarchy


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