Back to Devexpress

RichEditControl.ShowPrintPreview() Method

windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-3e3a737c.md

latest5.1 KB
Original Source

RichEditControl.ShowPrintPreview() Method

Invokes the Print Preview window.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public void ShowPrintPreview()
vb
Public Sub ShowPrintPreview

Remarks

The Print Preview form utilizes the Ribbon user interface by default. To select the Bars user interface, use the PrintingOptions.PrintPreviewFormKind property.

Note

This method invokes the Document Viewer, so you have to deploy additional assemblies required for this dialog. See the Redistribution and Deployment topic for more information.

Example

The following code checks the RichEditControl.IsPrintingAvailable property value and invokes the print preview window. The current RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.

View Example

csharp
static void buttonCustomAction_ItemClick_ShowPrintPreviewMethod(object sender, ItemClickEventArgs e) {
    RichEditControl richEdit = e.Item.Tag as RichEditControl;
    if(richEdit.IsPrintingAvailable) {
        richEdit.ShowPrintPreview();
    }
}
vb
Private Shared Sub buttonCustomAction_ItemClick_ShowPrintPreviewMethod(ByVal sender As Object, ByVal e As ItemClickEventArgs)
    Dim richEdit As RichEditControl = TryCast(e.Item.Tag, RichEditControl)
    If richEdit.IsPrintingAvailable Then
        richEdit.ShowPrintPreview()
    End If
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowPrintPreview() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-layout-api/CS/Form1.cs#L179

csharp
{
    richEditControl1.ShowPrintPreview();
}

winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L66

csharp
if(richEdit.IsPrintingAvailable) {
    richEdit.ShowPrintPreview();
}

winforms-richedit-layout-api/VB/Form1.vb#L148

vb
Private Sub simpleButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton2.Click
    richEditControl1.ShowPrintPreview()
End Sub

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L71

vb
If richEdit.IsPrintingAvailable Then
    richEdit.ShowPrintPreview()
End If

See Also

PrintPreviewCommand

QuickPrintCommand

PrintPreviewFormKind

ShowPrintDialog()

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace