ApiExamples.ExRendering.MyPrintDocument.OnBeginPrint C# (CSharp) Метод

OnBeginPrint() защищенный Метод

Called before the printing starts.
protected OnBeginPrint ( System.Drawing.Printing.PrintEventArgs e ) : void
e System.Drawing.Printing.PrintEventArgs
Результат void
            protected override void OnBeginPrint(PrintEventArgs e)
            {
                base.OnBeginPrint(e);

                // Initialize the range of pages to be printed according to the user selection.
                switch (this.PrinterSettings.PrintRange)
                {
                    case System.Drawing.Printing.PrintRange.AllPages:
                        this.mCurrentPage = 1;
                        this.mPageTo = this.mDocument.PageCount;
                        break;
                    case System.Drawing.Printing.PrintRange.SomePages:
                        this.mCurrentPage = this.PrinterSettings.FromPage;
                        this.mPageTo = this.PrinterSettings.ToPage;
                        break;
                    default:
                        throw new InvalidOperationException("Unsupported print range.");
                }
            }