private void Print_Click(object sender, RoutedEventArgs e) { PrintDocument printDoc = new PrintDocument(); // Name that will show in the spooler... printDoc.DocumentName = "Directory Tree"; printDoc.PrintPage += new EventHandler<PrintPageEventArgs>(printDoc_PrintPage); printDoc.Print(); } private void printDoc_PrintPage(object sender, PrintPageEventArgs e) { // Needs a UIElement (visual tree) e.PageVisual = DirectoriesTreeView;
// Setting true will ensure PrintPage is called again for subsequent pages e.HasMorePages = false; }
No comments:
Post a Comment