Click here to Skip to main content
15,893,668 members
Articles / Programming Languages / C#

DataGridView Print/Print Preview Solution - Part II

Rate me:
Please Sign up or sign in to vote.
5.00/5 (15 votes)
18 Jun 2009CPOL4 min read 77.5K   7.4K   47  
This article is the second one of two articles in which I want to show a solution for the Print Preview of the DataGridView object. One of the goals of my solution is to print the DataGridView keeping its styles automatically.
namespace GridPrintPreviewLib
{
    partial class frmPreviewDialog
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.glPrintPreviewControl1 = new GridPrintPreviewLib.GLPrintPreviewControl();
            this.SuspendLayout();
            // 
            // glPrintPreviewControl1
            // 
            this.glPrintPreviewControl1.AutoScroll = true;
            this.glPrintPreviewControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.glPrintPreviewControl1.Location = new System.Drawing.Point(0, 0);
            this.glPrintPreviewControl1.Name = "glPrintPreviewControl1";
            this.glPrintPreviewControl1.previewPages = null;
            this.glPrintPreviewControl1.printDocument = null;
            this.glPrintPreviewControl1.ShowUnit = System.Drawing.Printing.PrinterUnit.Display;
            this.glPrintPreviewControl1.Size = new System.Drawing.Size(640, 381);
            this.glPrintPreviewControl1.TabIndex = 0;
            this.glPrintPreviewControl1.ZoomFactor = 100;
            // 
            // frmPreviewDialog
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(640, 381);
            this.Controls.Add(this.glPrintPreviewControl1);
            this.Name = "frmPreviewDialog";
            this.Text = "Print Preview";
            this.ResumeLayout(false);

        }

        #endregion

        private GridPrintPreviewLib.GLPrintPreviewControl glPrintPreviewControl1;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Mediatech Solutions
Italy Italy
I’m an IT Project Manager for an Italian Betting Company and over the last 2 years I acquired experience in Betting area.
I have developed code in different object oriented languages (C#, C++, Java) for more than 10 years using a set of technology such as .Net, J2EE, multithreading, etc…

Comments and Discussions