예제 #1
0
 /// <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);
 }
예제 #2
0
        /// <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));
        }
예제 #3
0
		public Layout()
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			InitializeComponent();

			printPage = new PrintPageEventHandler(PrintPage);
			beginPrint = new PrintEventHandler(BeginPrint);
			queryPageSettings = new QueryPageSettingsEventHandler(QueryPageSettings);
		}
예제 #4
0
		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);
		}
예제 #5
0
        /// <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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
 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;
 }
예제 #8
0
 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);
 }