1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
4
using ICSharpCode.Core;
6
using System.Drawing.Printing;
7
using System.Windows.Forms;
8
using ICSharpCode.SharpDevelop.Gui;
10
namespace ICSharpCode.SharpDevelop.Util
13
/// Allows printing using the IPrintable interface.
15
public class WindowsFormsPrinting
17
public static void Print(IPrintable printable)
19
using (PrintDocument pdoc = printable.PrintDocument) {
21
using (PrintDialog ppd = new PrintDialog()) {
23
ppd.AllowSomePages = true;
24
if (ppd.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWin32Window) == DialogResult.OK) { // fixed by Roger Rubin
29
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Commands.Print.CreatePrintDocumentError}");
34
public static void PrintPreview(IPrintable printable)
36
using (PrintDocument pdoc = printable.PrintDocument) {
38
PrintPreviewDialog ppd = new PrintPreviewDialog();
41
ppd.Show(WorkbenchSingleton.MainWin32Window);
43
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Commands.Print.CreatePrintDocumentError}");