Skip to main content
A newer version of this page is available. .

TreeList.ShowPrintPreview() Method

Opens the Print Preview window with a Bars UI.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.2.dll

Declaration

public void 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 Printing Library is available. To check if printing and previewing the control is allowed, use the TreeList.IsPrintingAvailable property.

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

Example

The following example demonstrates how to print a TreeList with the TreeList.Print method, and show its print preview with the TreeList.ShowRibbonPrintPreview method.

The image below shows the Preview window for a sample Tree List control. The print commands provided by this window are displayed using a Ribbon UI.

Printing the XtraTreeList_Preview

using DevExpress.XtraTreeList;
// ...

private void ShowTreeListPreview(TreeList treeList) {
    // Check whether the Tree List can be previewed.
    if (!treeList.IsPrintingAvailable) {
        MessageBox.Show("The Printing Library is not found", "Error");
        return;
    }

    // Open the Preview window.
    treeList.ShowRibbonPrintPreview();
}

private void PrintTreeList(TreeList treeList) {
    // Check whether the Tree List can be printed.
    if (!treeList.IsPrintingAvailable) {
        MessageBox.Show("The Printing Library is not found", "Error");
        return;
    }

    // Print.
    treeList.Print();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.

See Also