本文整理匯總了C#中System.Drawing.Printing.PrintDocument._OnPrintPage方法的典型用法代碼示例。如果您正苦於以下問題:C# PrintDocument._OnPrintPage方法的具體用法?C# PrintDocument._OnPrintPage怎麽用?C# PrintDocument._OnPrintPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Printing.PrintDocument
的用法示例。
在下文中一共展示了PrintDocument._OnPrintPage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PrintLoop
private bool PrintLoop(PrintDocument document)
{
PrintPageEventArgs args2;
QueryPageSettingsEventArgs e = new QueryPageSettingsEventArgs((PageSettings) document.DefaultPageSettings.Clone());
do
{
document._OnQueryPageSettings(e);
if (e.Cancel)
{
return true;
}
args2 = this.CreatePrintPageEvent(e.PageSettings);
Graphics graphics = this.OnStartPage(document, args2);
args2.SetGraphics(graphics);
try
{
document._OnPrintPage(args2);
this.OnEndPage(document, args2);
}
finally
{
args2.Dispose();
}
if (args2.Cancel)
{
return true;
}
}
while (args2.HasMorePages);
return false;
}
示例2: PrintLoop
// Returns true if print was aborted.
// WARNING: if you have nested PrintControllers, this method won't get called on the inner one
// Add initialization code to StartPrint or StartPage instead.
private bool PrintLoop(PrintDocument document) {
QueryPageSettingsEventArgs queryEvent = new QueryPageSettingsEventArgs((PageSettings) document.DefaultPageSettings.Clone());
for (;;) {
document._OnQueryPageSettings(queryEvent);
if (queryEvent.Cancel) {
return true;
}
PrintPageEventArgs pageEvent = CreatePrintPageEvent(queryEvent.PageSettings);
Graphics graphics = OnStartPage(document, pageEvent);
pageEvent.SetGraphics(graphics);
try {
document._OnPrintPage(pageEvent);
OnEndPage(document, pageEvent);
}
finally {
pageEvent.Dispose();
}
if (pageEvent.Cancel) {
return true;
}
else if (!pageEvent.HasMorePages) {
return false;
}
else {
// loop
}
}
}