UMD.HCIL.Piccolo.PNode.printDocument_PrintPage C# (CSharp) Method

printDocument_PrintPage() protected method

Prints the node into the given Graphics context.
protected printDocument_PrintPage ( object sender, System.Drawing.Printing.PrintPageEventArgs e ) : void
sender object The source of the PrintPage event.
e System.Drawing.Printing.PrintPageEventArgs The PrintPageEventArgs.
return void
		protected virtual void printDocument_PrintPage(object sender, PrintPageEventArgs e) {
			Graphics g = e.Graphics;

			// Approximate the printable area of the page.  This approximation assumes
			// the unprintable margins are distributed equally between the left and right,
			// and top and bottom sides.  To exactly determine the printable area, you
			// must resort to the Win32 API.
			RectangleF displayRect = new RectangleF(
				e.MarginBounds.Left - 
				(e.PageBounds.Width - g.VisibleClipBounds.Width) / 2,
				e.MarginBounds.Top -
				(e.PageBounds.Height - g.VisibleClipBounds.Height) / 2,
				e.MarginBounds.Width, e.MarginBounds.Height);
				
			ScaleAndDraw(g, displayRect);
		}