本文整理汇总了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;
}