Back to Devexpress

TreeViewLink Class

windowsforms-devexpress-dot-xtraprintinglinks-cdc4c3c8.md

latest3.9 KB
Original Source

TreeViewLink Class

A link to print the TreeView control.

Namespace : DevExpress.XtraPrintingLinks

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
public class TreeViewLink :
    TreeViewLinkBase,
    IWinLink
vb
Public Class TreeViewLink
    Inherits TreeViewLinkBase
    Implements IWinLink

Remarks

Use the TreeViewLink class to print the TreeView control.

To do this, assign an existing TreeView object to the TreeViewLinkBase.TreeView property, and then call either the TreeViewLink.ShowPreview (TreeViewLink.ShowPreviewDialog) method to preview a document, or the TreeViewLink.Print (TreeViewLink.PrintDlg) method to send it to a printer.

Example

This example illustrates the usage of printing links to print standard Windows Forms controls. The XtraPrinting library contains printing links specifically designed for several common controls. The following code links a Microsoft TreeView control to a printing system and generates a report which lists the TreeView nodes.

csharp
using DevExpress.XtraPrintingLinks;
using DevExpress.XtraPrinting;
// ...

    // Create a new link.
    TreeViewLink treeViewLink1 = new TreeViewLink(printingSystem1);

    // Assign the TreeView control to be printed.
    treeViewLink1.TreeView = tvwSource;

    // Add the link to the collection.
    printingSystem1.Links.Add(treeViewLink1);
    printingSystem1.Links[0] = treeViewLink1;

    // Generate a report.
    printingSystem1.Links[0].CreateDocument();

    // Show the report to the user.
    printingSystem1.PreviewFormEx.Owner = this;
    printingSystem1.PreviewFormEx.Show();
vb
Imports DevExpress.XtraPrintingLinks
Imports DevExpress.XtraPrinting
' ...

    ' Create a new link.
    Dim TreeViewLink1 As TreeViewLink = New TreeViewLink(PrintingSystem1)

    ' Assign the TreeView control to be printed.
    TreeViewLink1.TreeView = tvwSource

    ' Add the link to the collection.
    PrintingSystem1.Links.Add(New Link())
    PrintingSystem1.Links(0) = TreeViewLink1

    ' Generate a report.
    PrintingSystem1.Links(0).CreateDocument()

    ' Show the report to the user.
    PrintingSystem1.PreviewFormEx.Owner = Me
    PrintingSystem1.PreviewFormEx.Show()

Inheritance

Object MarshalByRefObject Component LinkBase TreeViewLinkBase TreeViewLink

See Also

TreeViewLink Members

Printing Links

DevExpress.XtraPrintingLinks Namespace