ComponentOne FlexGrid for WinForms
GridPrinter Class
Members  Example 

C1.Win.C1FlexGrid Namespace : GridPrinter Class
Represents a class that encapsulates the control printing functionality, including page and printer settings, headers, and footers.
Syntax
'Declaration
 
Public Class GridPrinter 
public class GridPrinter 
Remarks
Example
private void Form1_Load(object sender, EventArgs e)
{
            _flex = new C1FlexGrid();
            _flex.Bounds = new Rectangle(20,80,800,500);
            this.Controls.Add(_flex);
            OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb");
            DataTable productsTable = new DataTable();
            new OleDbDataAdapter("Select * from Products",con).Fill(productsTable);
            _flex.DataSource = productsTable;
}

private void printGrd_Click(object sender, EventArgs e)
{
            GridPrinter gridPrinter = _flex.PrintParameters;
            // Set up the header and footer text and fonts.
            gridPrinter.Header = "C1FlexGrid\t\t" + DateTime.Now.ToShortDateString();
            gridPrinter.Footer = "\t\tPage {0} of {1}";
            gridPrinter.HeaderFont = new Font("Arial Black", 14, FontStyle.Bold);
            gridPrinter.FooterFont = new Font("Arial Narrow", 8, FontStyle.Italic);
            
            //Get the PrintPreviewDialog object.
            Form previewDialog = gridPrinter.PrintPreviewDialog as Form;

            //display the preview dialog with a custom caption and in a maximized state:
            previewDialog.Text = "Print Preview";
            previewDialog.BackColor = Color.LightBlue;
            previewDialog.WindowState = FormWindowState.Maximized;

            // Get the grid' s PrintDocument object.
            System.Drawing.Printing.PrintDocument pd = _flex.PrintParameters.PrintDocument;

            // Set up the page (landscape, 1.5" left margin).
            pd.DefaultPageSettings.Landscape = true;
            pd.DefaultPageSettings.Margins.Left = 150;

            //Preview the grid
            gridPrinter.PrintGridFlags = PrintGridFlags.ShowPreviewDialog;

            // Print the grid.
            _flex.PrintGrid("C1FlexGrid"); 
}
Inheritance Hierarchy

System.Object
   C1.Win.C1FlexGrid.GridPrinter

See Also

Reference

GridPrinter Members
C1.Win.C1FlexGrid Namespace