当前位置: 首页>>代码示例>>C#>>正文


C# PrintDialog.Reset方法代码示例

本文整理汇总了C#中System.Windows.Forms.PrintDialog.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# PrintDialog.Reset方法的具体用法?C# PrintDialog.Reset怎么用?C# PrintDialog.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.PrintDialog的用法示例。


在下文中一共展示了PrintDialog.Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnFilePrint

		public virtual bool OnFilePrint()
		{
			CheckDisposed();

			// In case the print layout view has never been displayed, we configure it now.
			Configure();

			using (PrintDialog dlg = new PrintDialog())
			{
				dlg.Reset();
				dlg.Document = new PrintDocument();
				dlg.AllowSomePages = true;
				dlg.AllowSelection = false;
				dlg.ShowHelp = true;
				dlg.HelpRequest += new EventHandler(ShowPrintDlgHelp);
				dlg.PrinterSettings.MinimumPage = 1;
				dlg.PrinterSettings.FromPage = 1;
				dlg.PrinterSettings.ToPage = 1;
				// ENHANCE: Would "dlg.UseEXDialog" get us any of the enhancements we need?

				// ENHANCE: Displaying this dialog is slow (loads a lot of DLLs), at least in Debug
				// mode. Tried displaying a wait cursor (wrapped around this entire method) but it
				// didn't work.
				if (dlg.ShowDialog(this) != DialogResult.OK)
					return true;

				if (MiscUtils.IsUnix)
					dlg.Document.DefaultPageSettings.PaperSize = new PaperSize("Custom",
						Publication.PaperWidth/720, Publication.PaperHeight/720);

				// REVIEW: .NET does not appear to handle the collation setting correctly
				// so for now, we do not support non-collated printing.  Forcing the setting
				// seems to work fine.
				if (dlg.PrinterSettings.Copies > 1)
					dlg.Document.PrinterSettings.Collate = true;

				switch (dlg.PrinterSettings.PrintRange)
				{
					case PrintRange.AllPages:
						m_currentPrintPage = 1;
						break;

					case PrintRange.Selection:
						// TODO:  This is not really the selection, for now, it will just print
						// page 1 because we are not sure what the selection is.  Also, we want
						// to consider not supporting printing the selection.
						m_currentPrintPage = 1;
						break;

					case PrintRange.SomePages:
						m_currentPrintPage = dlg.PrinterSettings.FromPage;
						break;
				}
				SimpleRootSite.PrintWithErrorHandling(this, dlg.Document, FindForm());
			}
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:57,代码来源:PublicationControl.cs


注:本文中的System.Windows.Forms.PrintDialog.Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。