本文整理汇总了C#中System.Drawing.Printing.PrintEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PrintEventArgs类的具体用法?C# PrintEventArgs怎么用?C# PrintEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrintEventArgs类属于System.Drawing.Printing命名空间,在下文中一共展示了PrintEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnBeginPrint
protected override void OnBeginPrint(PrintEventArgs e) {
base.OnBeginPrint(e);
m_iTextLength = m_oScintillaControl.TextLength;
m_iLastPrintPosition = 0;
m_iCurrentPrintPage = 1;
}
示例2: OnStartPrint
public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
Debug.Assert(dc == null && graphics == null, "PrintController methods called in the wrong order?");
// For security purposes, don't assume our public methods methods are called in any particular order
CheckSecurity();
base.OnStartPrint(document, e);
try {
if (!document.PrinterSettings.IsValid)
throw new InvalidPrinterException(document.PrinterSettings);
IntSecurity.AllPrintingAndUnmanagedCode.Assert();
// We need a DC as a reference; we don't actually draw on it.
// We make sure to reuse the same one to improve performance.
dc = document.PrinterSettings.CreateInformationContext(modeHandle);
}
finally {
CodeAccessPermission.RevertAssert();
}
}
示例3: OnBeginPrint
/// <summary>
/// BeginPrint event handler
/// </summary>
/// <param name="e">PrintEventArgs object</param>
protected override void OnBeginPrint(PrintEventArgs e)
{
base.OnBeginPrint(e);
cardsPrinted = 0;
dispQsos = qsos.GetDispQsosList(QslCard);
if(PrinterSettings == null || QslCard == null)
{
App.Logger.Log("Programming error: Attempting to print cards before " +
"CardPrintDocument.PrintProperties or CardPrintDocument" +
".QslCard is initialized.");
MessageBox.Show("Programming Error: Please log a bug report and include " +
"the contents of the log file", "Programming Error",
MessageBoxButton.OK, MessageBoxImage.Error);
e.Cancel = true;
return;
}
this.DocumentName = "Qsl Cards";
PrinterSettings settings = new PrinterSettings();
settings.PrinterName = PrintProperties.PrinterName;
settings.DefaultPageSettings.PaperSize = PrintProperties.PrinterPaperSize;
settings.DefaultPageSettings.PrinterResolution = PrintProperties.Resolution;
settings.DefaultPageSettings.PaperSource = PrintProperties.Source;
if(PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeTopLeft ||
PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeTopCenter ||
PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeCenter)
{
settings.DefaultPageSettings.Landscape = true;
}
this.PrinterSettings = settings;
CalculateCardsPerPage();
CalculateOffsets();
}
示例4: OnEndPrint
protected virtual void OnEndPrint(PrintEventArgs e)
{
if (this.endPrintHandler != null)
{
this.endPrintHandler(this, e);
}
}
示例5: OnBeginPrint
protected override void OnBeginPrint(PrintEventArgs ev)
{
base.OnBeginPrint(ev);
if (this.fntPrintFont != null)
return;
this.fntPrintFont = new Font("Times New Roman", 12f);
}
示例6: OnBeginPrint
protected override void OnBeginPrint(PrintEventArgs e)
{
this.DocumentName = Sheet.Name.Replace(":", "");
this.PageNumber = 0;
base.OnBeginPrint(e);
}
示例7: OnEndPrint
public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
{
base.OnEndPrint(document, e);
document.PrinterSettings.PrintToFile = _isPrintToFile;
if (ShowAfterPrint)
System.Diagnostics.Process.Start(this.FileName);
Document doc = new Document();
doc.DateCreated = File.GetLastWriteTime(this.FileName);
if (_sit == PrintSituation.Claim)
{
doc.DocCategory = DefC.GetByExactName(DefCat.ImageCats, "EClaims");
if (doc.DocCategory == 0)
{
Def d = new Def() { Category = DefCat.ImageCats, ItemName = "EClaims" };
doc.DocCategory = Defs.Insert(d);
DataValid.SetInvalid(InvalidType.Defs);
}
}
else
{
doc.DocCategory = DefC.GetList(DefCat.ImageCats)[0].DefNum;//First category.
}
doc.FileName = Path.GetFileName(this.FileName);
doc.Description = doc.FileName;
doc.PatNum = _patient.PatNum;
Documents.Insert(doc);
}
示例8: OnBeginPrint
protected override void OnBeginPrint(PrintEventArgs e)
{
base.OnBeginPrint(e);
if (m_InkFriendlyMode)
{
m_HeaderTextBrush = new SolidBrush(Color.Black);
m_HeaderBackgroundBrush = new SolidBrush(Color.White);
m_BorderPen = new Pen(Color.DarkGray, 3);
m_BackgroundBrush = new SolidBrush(Color.White);
m_WorkoutDetailsBrush = new SolidBrush(Color.Black);
}
else
{
m_HeaderTextBrush = new SolidBrush(Color.White);
m_HeaderBackgroundBrush = new SolidBrush(Color.Black);
m_BorderPen = new Pen(Color.Black, 3);
m_BackgroundBrush = new SolidBrush(Color.LightGray);
m_WorkoutDetailsBrush = new SolidBrush(Color.Black);
}
m_HeaderFont = new Font(FontFamily.GenericSansSerif, 16, FontStyle.Bold);
m_HeaderNotesFont = new Font(FontFamily.GenericSansSerif, 10);
m_WorkoutDetailsFont = new Font(FontFamily.GenericSansSerif, 10);
m_StepHeaderFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold);
}
示例9: OnStartPrint
public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
Debug.Assert(dc == null && graphics == null, "PrintController methods called in the wrong order?");
// For security purposes, don't assume our public methods methods are called in any particular order
CheckSecurity(document);
base.OnStartPrint(document, e);
// the win32 methods below SuppressUnmanagedCodeAttributes so assertin on UnmanagedCodePermission is redundant
if (!document.PrinterSettings.IsValid)
throw new InvalidPrinterException(document.PrinterSettings);
dc = document.PrinterSettings.CreateDeviceContext(modeHandle);
SafeNativeMethods.DOCINFO info = new SafeNativeMethods.DOCINFO();
info.lpszDocName = document.DocumentName;
if (document.PrinterSettings.PrintToFile)
info.lpszOutput = document.PrinterSettings.OutputPort; //This will be "FILE:"
else
info.lpszOutput = null;
info.lpszDatatype = null;
info.fwType = 0;
int result = SafeNativeMethods.StartDoc(new HandleRef(this.dc, dc.Hdc), info);
if (result <= 0) {
int error = Marshal.GetLastWin32Error();
if (error == SafeNativeMethods.ERROR_CANCELLED) {
e.Cancel = true;
}
else {
throw new Win32Exception(error);
}
}
}
示例10: OnBeginPrint
/// <summary>
/// Raises the System.Drawing.Printing.PrintDocument.BeginPrint event. It is called
/// after the System.Drawing.Printing.PrintDocument.Print method is called and before
/// the first page of the document prints.
/// </summary>
/// <param name="e">A System.Drawing.Printing.PrintEventArgs that contains the event data.</param>
protected override void OnBeginPrint(PrintEventArgs e)
{
base.OnBeginPrint(e);
//Calculate range of pages for print
switch (PrinterSettings.PrintRange)
{
case PrintRange.Selection:
case PrintRange.CurrentPage: //Curent page
PrinterSettings.FromPage = _pdfDoc.Pages.CurrentIndex + 1;
PrinterSettings.ToPage = _pdfDoc.Pages.CurrentIndex + 1;
break;
case PrintRange.SomePages: //The range specified by the user
break;
default: //All pages
PrinterSettings.FromPage = PrinterSettings.MinimumPage;
PrinterSettings.ToPage = PrinterSettings.MaximumPage;
break;
}
_docForPrint = InitDocument();
if (_docForPrint == IntPtr.Zero)
{
e.Cancel = true;
return;
}
_pageForPrint = _useDP ? 0 : PrinterSettings.FromPage - 1;
}
示例11: OnStartPrint
/// <include file='doc\PrintControllerWithStatusDialog.uex' path='docs/doc[@for="PrintControllerWithStatusDialog.OnStartPrint"]/*' />
/// <internalonly/>
/// <devdoc>
/// <para>
/// Implements StartPrint by delegating to the underlying controller.
/// </para>
/// </devdoc>
public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
base.OnStartPrint(document, e);
this.document = document;
pageNumber = 1;
if (SystemInformation.UserInteractive) {
backgroundThread = new BackgroundThread(this); // starts running & shows dialog automatically
}
// OnStartPrint does the security check... lots of
// extra setup to make sure that we tear down
// correctly...
//
try {
underlyingController.OnStartPrint(document, e);
}
catch {
if (backgroundThread != null) {
backgroundThread.Stop();
}
throw;
}
finally {
if (backgroundThread != null && backgroundThread.canceled) {
e.Cancel = true;
}
}
}
示例12: OnBeginPrint
/// <summary>
/// Performs processing when printing begins</summary>
/// <param name="e">Event args</param>
protected override void OnBeginPrint(PrintEventArgs e)
{
base.OnBeginPrint(e);
m_font = new Font("Courier", 10);
if (m_fileName != null)
{
try
{
m_streamReader = new StreamReader(m_fileName);
}
catch (FileNotFoundException)
{
e.Cancel = true;
}
}
else if (m_stream != null)
{
m_streamReader = new StreamReader(m_stream);
}
else
e.Cancel = true;
}
示例13: OnStartPrint
public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
{
base.OnStartPrint(document, e);
this.document = document;
this.pageNumber = 1;
if (SystemInformation.UserInteractive)
{
this.backgroundThread = new BackgroundThread(this);
}
try
{
this.underlyingController.OnStartPrint(document, e);
}
catch
{
if (this.backgroundThread != null)
{
this.backgroundThread.Stop();
}
throw;
}
finally
{
if ((this.backgroundThread != null) && this.backgroundThread.canceled)
{
e.Cancel = true;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:PrintControllerWithStatusDialog.cs
示例14: OnEndPrint
public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
{
this.CheckSecurity();
this.dc.Dispose();
this.dc = null;
base.OnEndPrint(document, e);
}
示例15: OnEndPrint
public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
{
this.CheckSecurity(document);
System.Drawing.IntSecurity.UnmanagedCode.Assert();
try
{
if (this.dc != null)
{
try
{
int num = e.Cancel ? SafeNativeMethods.AbortDoc(new HandleRef(this.dc, this.dc.Hdc)) : SafeNativeMethods.EndDoc(new HandleRef(this.dc, this.dc.Hdc));
if (num <= 0)
{
throw new Win32Exception();
}
}
finally
{
this.dc.Dispose();
this.dc = null;
}
}
}
finally
{
CodeAccessPermission.RevertAssert();
}
base.OnEndPrint(document, e);
}