122 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Configuration;
 | |
| using System.Drawing.Printing;
 | |
| 
 | |
| namespace GoldPrinter
 | |
| {
 | |
| 	public class PrinterPageSetting
 | |
| 	{
 | |
| 		private IPrinterPageSetting _printerPageSetting;
 | |
| 
 | |
| 		private PrintModeFlag _printModeFlag;
 | |
| 
 | |
| 		public event PrintPageDelegate PrintPage
 | |
| 		{
 | |
| 			add
 | |
| 			{
 | |
| 				this._printerPageSetting.PrintPage += new PrintPageDelegate(value.Invoke);
 | |
| 			}
 | |
| 			remove
 | |
| 			{
 | |
| 				this._printerPageSetting.PrintPage -= new PrintPageDelegate(value.Invoke);
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public PrintModeFlag PrintMode
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this._printModeFlag;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this._printModeFlag = value;
 | |
| 				if (this._printModeFlag == PrintModeFlag.Win)
 | |
| 				{
 | |
| 					this._printerPageSetting = new WinPrinterPageSetting();
 | |
| 				}
 | |
| 				else if (this._printModeFlag == PrintModeFlag.Web)
 | |
| 				{
 | |
| 					this._printerPageSetting = new WebPrinterPageSetting();
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public PrintDocument PrintDocument
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this._printerPageSetting.PrintDocument;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this._printerPageSetting.PrintDocument = value;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public PrintPageDelegate PrintPageValue
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this._printerPageSetting.PrintPageValue;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this._printerPageSetting.PrintPageValue = value;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public ImportExcelDelegate ImportExcelValue
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				return this._printerPageSetting.ImportExcelValue;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				this._printerPageSetting.ImportExcelValue = value;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public PrinterPageSetting() : this(null)
 | |
| 		{
 | |
| 		}
 | |
| 
 | |
| 		public PrinterPageSetting(PrintDocument printDocument)
 | |
| 		{
 | |
| 			string text = "";// ConfigurationSettings.AppSettings["PrintMode"];
 | |
| 			if (text == null)
 | |
| 			{
 | |
| 				text = "Win";
 | |
| 			}
 | |
| 			if (text.ToUpper() == "WIN")
 | |
| 			{
 | |
| 				this.PrintMode = PrintModeFlag.Win;
 | |
| 			}
 | |
| 			else
 | |
| 			{
 | |
| 				this.PrintMode = PrintModeFlag.Web;
 | |
| 			}
 | |
| 			if (printDocument != null)
 | |
| 			{
 | |
| 				this._printerPageSetting.PrintDocument = printDocument;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		public PageSettings ShowPageSetupDialog()
 | |
| 		{
 | |
| 			return this._printerPageSetting.ShowPageSetupDialog();
 | |
| 		}
 | |
| 
 | |
| 		public PrinterSettings ShowPrintSetupDialog()
 | |
| 		{
 | |
| 			return this._printerPageSetting.ShowPrintSetupDialog();
 | |
| 		}
 | |
| 
 | |
| 		public void ShowPrintPreviewDialog()
 | |
| 		{
 | |
| 			this._printerPageSetting.ShowPrintPreviewDialog();
 | |
| 		}
 | |
| 	}
 | |
| }
 |