當前位置: 首頁>>代碼示例>>C#>>正文


C# PrintDocument.ThrowIfNull方法代碼示例

本文整理匯總了C#中System.Drawing.Printing.PrintDocument.ThrowIfNull方法的典型用法代碼示例。如果您正苦於以下問題:C# PrintDocument.ThrowIfNull方法的具體用法?C# PrintDocument.ThrowIfNull怎麽用?C# PrintDocument.ThrowIfNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Printing.PrintDocument的用法示例。


在下文中一共展示了PrintDocument.ThrowIfNull方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PrintOptionsDialog

        /// <summary>
        /// Initializes a new instance of the <see cref="PrintOptionsDialog"/> class.
        /// </summary>
        /// <param name="pto">The pto.</param>
        /// <param name="doc">The document.</param>
        /// <exception cref="System.ArgumentNullException">pto or doc</exception>
        public PrintOptionsDialog(PlanExportSettings pto, PrintDocument doc)
        {
            pto.ThrowIfNull(nameof(pto));

            doc.ThrowIfNull(nameof(doc));

            InitializeComponent();

            string curPrinter = doc.PrinterSettings.PrinterName;

            m_pto = pto;

            foreach (String printer in PrinterSettings.InstalledPrinters)
            {
                int index = comboPrinters.Items.Add(printer);

                doc.PrinterSettings.PrinterName = printer;
                if (doc.PrinterSettings.IsDefaultPrinter)
                    comboPrinters.SelectedIndex = index;
            }

            // If this dialog is cancelled, we dont want the name of the printer to have changed
            doc.PrinterSettings.PrinterName = curPrinter;

            EntryFinishDate = pto.EntryFinishDate;
            EntryNumber = pto.EntryNumber;
            EntryStartDate = pto.EntryStartDate;
            EntryTrainingTimes = pto.EntryTrainingTimes;
            EntryNotes = pto.EntryNotes;
            FooterCount = pto.FooterCount;
            FooterDate = pto.FooterDate;
            FooterTotalTime = pto.FooterTotalTime;
            IncludeHeader = pto.IncludeHeader;
        }
開發者ID:,項目名稱:,代碼行數:40,代碼來源:


注:本文中的System.Drawing.Printing.PrintDocument.ThrowIfNull方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。