/// <summary> /// Shows the print dialog to choose the printer, and then prints the document. /// </summary> /// <param name="doc">The graph document to print out.</param> /// <returns>True if user closed the dialog with OK and the document was printed, false if user cancelled the dialog or document failed to print.</returns> public static bool ShowPrintDialogAndPrint(this GraphDocument doc) { try { Altaxo.Gui.Graph.PrintingController ctrl = new Gui.Graph.PrintingController(); ctrl.InitializeDocument(doc); Current.Gui.FindAndAttachControlTo(ctrl); if (Current.Gui.ShowDialog(ctrl, "Print")) { doc.Print(); return true; } } catch (Exception ex) { Current.Gui.ErrorMessageBox(ex.ToString()); } return false; }
/// <summary> /// Shows the print dialog to choose the printer, and then prints the document. /// </summary> /// <param name="doc">The graph document to print out.</param> /// <returns>True if user closed the dialog with OK and the document was printed, false if user cancelled the dialog or document failed to print.</returns> public static bool ShowPrintDialogAndPrint(this GraphDocument doc) { try { var ctrl = new Gui.Graph.PrintingController(); ctrl.InitializeDocument(doc); Current.Gui.FindAndAttachControlTo(ctrl); if (Current.Gui.ShowDialog(ctrl, "Print")) { doc.Print(); return(true); } } catch (Exception ex) { Current.Gui.ErrorMessageBox(ex.ToString()); } return(false); }