本文整理匯總了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;
}
}
}
}
}
}
示例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;
}
}
}
}