Provides data and methods for reporting

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public class PrintGridPageEventArgs : EventArgs
Visual Basic
Public Class PrintGridPageEventArgs
	Inherits EventArgs
Visual C++
public ref class PrintGridPageEventArgs : public EventArgs
type PrintGridPageEventArgs =  
        inherit EventArgs


Grid provides standard printing and print preview features via PrintDocument object that enables document printing and previewing.

The example below demonstrates implementation of document preview feature:

 Copy imageCopy
public void PrintPreview(Grid grid)
   PrintPreviewDialog ppd = new PrintPreviewDialog();
   ppd.Document = grid.PrintDocument;

The following example demonstrates implementation of content printing feature.

 Copy imageCopy
public void PrintContent(Grid grid)
   PrintDialog pd = new PrintDialog();
   pd.Document = grid.PrintDocument;

The grid provides callback feature for print customization. This feature can also be used to customize page headers and footers:

 Copy imageCopy
grid.PrintPage += delegate(object sender, PrintGridPageEventArgs e)
    //Print a page header
    Rectangle rcHeader = new Rectangle(e.MarginBounds.X, e.PageBounds.Y, e.MarginBounds.Width, e.MarginBounds.Y - e.PageBounds.Y);
    using(System.Drawing.StringFormat sf = new System.Drawing.StringFormat())
        rcHeader.Inflate(0, -10);
        sf.LineAlignment = StringAlignment.Far;
        sf.Alignment = StringAlignment.Center;
        e.Graphics.DrawString("This is a page header. Print your text here!", SystemFonts.MenuFont, SystemBrushes.GrayText, rcHeader, sf);    

    //Print a page footer
    Rectangle rcFooter = new Rectangle(e.MarginBounds.X, e.MarginBounds.Bottom, e.MarginBounds.Width, e.PageBounds.Bottom - e.MarginBounds.Bottom);
    using (System.Drawing.StringFormat sf = new System.Drawing.StringFormat())
        rcFooter.Inflate(0, -10);
        sf.LineAlignment = StringAlignment.Near;
        sf.Alignment = StringAlignment.Center;
        e.Graphics.DrawString(string.Format("Page {0} of {1}\r\nThis is a page footer. Print your text here!", e.PageNumber, e.PagesCount), SystemFonts.MenuFont, SystemBrushes.GrayText, rcFooter, sf);

Inheritance Hierarchy


See Also