protected override void OnPrintPage(PrintPageEventArgs ev) { int num1; base.OnPrintPage(ev); Rectangle rectangle1 = ev.MarginBounds; if (this.startPrinting) { this.syntaxEdit.Bounds = ev.MarginBounds; ((DisplayStrings)this.syntaxEdit.DisplayLines).ScanToEnd(true); int num2 = this.syntaxEdit.DisplayLines.GetCount() - 1; num1 = Math.Max(this.syntaxEdit.LinesInHeight(), 1); this.pages = num2 / num1; if ((num2 % num1) != 0) { this.pages++; } this.pageCount = Math.Max(this.pages, 1); if (base.PrinterSettings.PrintRange == PrintRange.SomePages) { this.pages = Math.Min(this.pages, (int)((base.PrinterSettings.ToPage - base.PrinterSettings.FromPage) + 1)); this.pageIndex = base.PrinterSettings.FromPage - 1; this.startLine += (num1 * this.pageIndex); } this.pages = Math.Max(this.pages, 1); this.startPrinting = false; } Rectangle rectangle2 = rectangle1; num1 = this.syntaxEdit.Painter.FontHeight; if (num1 != 0) { rectangle2.Height = (rectangle2.Height / num1) * num1; } float single1 = ev.Graphics.DpiX / 100f; float single2 = ev.Graphics.DpiY / 100f; ITextPainter painter1 = this.syntaxEdit.Painter; painter1.BeginPaint(ev.Graphics); try { painter1.Transform(0, 0, single1, single2); try { if ((this.printing.Options & PrintOptions.UseHeader) != PrintOptions.None) { Rectangle rectangle3 = new Rectangle(rectangle1.Left - this.printing.Header.Offset.X, rectangle1.Top - (this.printing.Header.Font.Height + this.printing.Header.Offset.Y), rectangle1.Width + (this.printing.Header.Offset.X * 2), this.printing.Header.Font.Height); this.printing.Header.Paint(painter1, rectangle3, this.pageIndex, this.pageCount, false); } if (((this.printing.Options & PrintOptions.UseFooter) != PrintOptions.None) || ((this.printing.Options & PrintOptions.PageNumbers) != PrintOptions.None)) { Rectangle rectangle4 = new Rectangle(rectangle1.Left - this.printing.Footer.Offset.X, rectangle1.Bottom + this.printing.Footer.Offset.Y, rectangle1.Width + (this.printing.Footer.Offset.X * 2), this.printing.Footer.Font.Height); this.printing.Footer.Paint(painter1, rectangle4, this.pageIndex, this.pageCount, (this.printing.Options & PrintOptions.PageNumbers) != PrintOptions.None); } } finally { painter1.EndTransform(); } ((SyntaxEdit)this.syntaxEdit).PaintWindow(painter1, this.startLine, new Rectangle(new Point(0, 0), rectangle2.Size), rectangle1.Location, single1, single2, true); this.startLine += Math.Max(this.syntaxEdit.LinesInHeight(), 1); this.page++; this.pageIndex++; ev.HasMorePages = this.page < this.pages; } finally { painter1.EndPaint(ev.Graphics); } }