Printing in Windows Forms TreeView

The TreeView Control has in-built support for printing. To print the content of treeview, convert the treeview into the printable document using TreeViewPrintDocument.

TreeViewPrintDocument printDocument = new TreeViewPrintDocument(this.treeViewAdv1);
'Convert the Treeview as printing document
Dim printDocument As New TreeViewPrintDocument(Me.treeViewAdv1)
'Print the contents of the Grid

PrepareTreeImage is used to gets an image that shows the entire tree, not just what is visible on the form.