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


C# PrintDocument._OnEndPrint方法代码示例

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


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

示例1: Print

 internal void Print(PrintDocument document)
 {
     PrintAction printToPreview;
     IntSecurity.SafePrinting.Demand();
     if (this.IsPreview)
     {
         printToPreview = PrintAction.PrintToPreview;
     }
     else
     {
         printToPreview = document.PrinterSettings.PrintToFile ? PrintAction.PrintToFile : PrintAction.PrintToPrinter;
     }
     PrintEventArgs e = new PrintEventArgs(printToPreview);
     document._OnBeginPrint(e);
     if (e.Cancel)
     {
         document._OnEndPrint(e);
     }
     else
     {
         this.OnStartPrint(document, e);
         if (e.Cancel)
         {
             document._OnEndPrint(e);
             this.OnEndPrint(document, e);
         }
         else
         {
             bool flag = true;
             try
             {
                 flag = this.PrintLoop(document);
             }
             finally
             {
                 try
                 {
                     try
                     {
                         document._OnEndPrint(e);
                         e.Cancel = flag | e.Cancel;
                     }
                     finally
                     {
                         this.OnEndPrint(document, e);
                     }
                 }
                 finally
                 {
                     if (!IntSecurity.HasPermission(IntSecurity.AllPrinting))
                     {
                         IntSecurity.AllPrinting.Assert();
                         document.PrinterSettings.PrintDialogDisplayed = false;
                     }
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:59,代码来源:PrintController.cs

示例2: Print

        internal void Print(PrintDocument document) {
            IntSecurity.SafePrinting.Demand();
            // Most of the printing security is left to the individual print controller

            //
            // Get the PrintAction for this event
            PrintAction printAction;
            if (IsPreview)
            {
                printAction = PrintAction.PrintToPreview;
            }
            else {
                printAction = document.PrinterSettings.PrintToFile ? PrintAction.PrintToFile : PrintAction.PrintToPrinter;
            }

            // Check that user has permission to print to this particular printer
            PrintEventArgs printEvent = new PrintEventArgs(printAction);
            document._OnBeginPrint(printEvent);
            if (printEvent.Cancel) {
                document._OnEndPrint(printEvent);
                return;
            }

            OnStartPrint(document, printEvent);
            if (printEvent.Cancel) {
                document._OnEndPrint(printEvent);
                OnEndPrint(document, printEvent);
                return;
            }

            bool canceled = true;

            try {
                canceled = PrintLoop(document);
            }
            finally {
                try {
                    try {
                        document._OnEndPrint(printEvent);
                        printEvent.Cancel = canceled | printEvent.Cancel;
                    }
                    finally {
                        OnEndPrint(document, printEvent);
                    }
                }
                finally {
                    if (!IntSecurity.HasPermission(IntSecurity.AllPrinting)) {
                        // Ensure programs with SafePrinting only get to print once for each time they
                        // throw up the PrintDialog.
                        IntSecurity.AllPrinting.Assert();
                        document.PrinterSettings.PrintDialogDisplayed = false;
                    }
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:55,代码来源:PrintController.cs


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