/// <summary> /// Créer le rapport. /// </summary> protected Rapport() { PrinterSettings = m_pageSettings.PrinterSettings; PrintController = new StandardPrintController(); // Pour enlever la boîte Annuler, // (elle reste dans Aperçu...) QueryPageSettings += new QueryPageSettingsEventHandler(this.MonQPSEH); }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// querypagesettingseventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this QueryPageSettingsEventHandler querypagesettingseventhandler, Object sender, QueryPageSettingsEventArgs e, AsyncCallback callback) { if (querypagesettingseventhandler == null) { throw new ArgumentNullException("querypagesettingseventhandler"); } return(querypagesettingseventhandler.BeginInvoke(sender, e, callback, null)); }
public Layout() { /// /// Required for Windows.Forms Class Composition Designer support /// InitializeComponent(); printPage = new PrintPageEventHandler(PrintPage); beginPrint = new PrintEventHandler(BeginPrint); queryPageSettings = new QueryPageSettingsEventHandler(QueryPageSettings); }
public Layout(System.ComponentModel.IContainer container) { /// /// Required for Windows.Forms Class Composition Designer support /// container.Add(this); InitializeComponent(); printPage = new PrintPageEventHandler(PrintPage); beginPrint = new PrintEventHandler(BeginPrint); queryPageSettings = new QueryPageSettingsEventHandler(QueryPageSettings); }
/// <summary> /// Called when [query page settings]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The /// <see cref="T:System.Drawing.Printing.QueryPageSettingsEventArgs"/> /// instance containing the event data.</param> protected virtual void OnQueryPageSettings ( object sender, QueryPageSettingsEventArgs e ) { ++_pageNumber; QueryPageSettingsEventHandler handler = QueryPageSettings; if (handler != null) { handler(this, e); } }
public void QueryPageSettings_SetValue_ReturnsExpected() { bool flag = false; var queryPageSettingsHandler = new QueryPageSettingsEventHandler((sender, e) => flag = true); using (var document = new PrintDocument()) { document.PrintController = new TestPrintController(); document.QueryPageSettings += queryPageSettingsHandler; document.Print(); Assert.True(flag); flag = false; document.QueryPageSettings -= queryPageSettingsHandler; document.Print(); Assert.False(flag); } }
public override bool ShowPrintPreviewDialog(PrintPageEventHandler printPageEventHandler, QueryPageSettingsEventHandler queryPageSettingsEventHandler) { try { System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog(); Current.PrintingService.PrintDocument.PrintPage += printPageEventHandler; Current.PrintingService.PrintDocument.QueryPageSettings += queryPageSettingsEventHandler; dlg.Document = Current.PrintingService.PrintDocument; dlg.ShowDialog(MainWindow); dlg.Dispose(); return true; } catch (Exception ex) { Current.Gui.ErrorMessageBox(ex.ToString()); } finally { Current.PrintingService.PrintDocument.PrintPage -= printPageEventHandler; Current.PrintingService.PrintDocument.QueryPageSettings -= queryPageSettingsEventHandler; } return false; }
public override bool ShowPrintPreviewDialog(PrintPageEventHandler printPageEventHandler, QueryPageSettingsEventHandler queryPageSettingsEventHandler) { try { System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog(); Current.PrintingService.PrintDocument.PrintPage += printPageEventHandler; Current.PrintingService.PrintDocument.QueryPageSettings += queryPageSettingsEventHandler; dlg.Document = Current.PrintingService.PrintDocument; dlg.ShowDialog(MainWindow); dlg.Dispose(); return(true); } catch (Exception ex) { Current.Gui.ErrorMessageBox(ex.ToString()); } finally { Current.PrintingService.PrintDocument.PrintPage -= printPageEventHandler; Current.PrintingService.PrintDocument.QueryPageSettings -= queryPageSettingsEventHandler; } return(false); }