LayoutControl.ShowPrintPreview() Method

Opens the Print Preview window for the LayoutControl with a Bars UI.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v20.1.dll

Declaration

public void ShowPrintPreview()
Public Sub ShowPrintPreview

Remarks

The Print Preview window displays the control's data as it will appear when it is printed. The control can be previewed and printed if the XtraPrinting Library is available. To check if printing and previewing the control is allowed, use the LayoutControl.IsPrintingAvailable property.

To display the Print Preview window with a Ribbon UI, use the LayoutControl.ShowRibbonPrintPreview method.

Examples

The following example demonstrates how to print a LayoutControl and show its Print Preivew. The LayoutControl.Print and LayoutControl.ShowPrintPreview methods are called respectively.

using DevExpress.XtraLayout;
// ...

private void ShowLayoutControlPreview(LayoutControl layout) {
    // Check whether the LayoutControl can be previewed.
    if (!layout.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting' library is not found", "Error");
        return;
    }

    // Open the Preview window.
    layout.ShowPrintPreview();
}

private void PrintLayoutControl(LayoutControl layout) {
    // Check whether the LayoutControl can be printed.
    if (!layout.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting' library is not found", "Error");
        return;
    }

    // Print.
    layout.Print();
}
See Also