Exemplo n.º 1
0
 /// <summary>
 /// show the PrintPrevie dialog
 /// </summary>
 private void button2_Click(object sender, System.EventArgs e)
 {
     if (this.gridControl1 != null)
     {
         try
         {
             //uses the default printer
             GridPrintToFitDocument pd  = new GridPrintToFitDocument(this.gridControl1, true);
             PrintPreviewDialog     dlg = new PrintPreviewDialog();
             dlg.Document = pd;
             dlg.ShowDialog();
         }
         catch (Exception ex)
         {
             MessageBox.Show("An error occurred attempting to preview the grid - " + ex.Message);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Print the Gird with fit to the size
 /// </summary>
 private void button3_Click(object sender, System.EventArgs e)
 {
     if (this.gridControl1 != null)
     {
         try
         {
             GridPrintToFitDocument pd  = new GridPrintToFitDocument(this.gridControl1, true);
             PrintDialog            dlg = new PrintDialog();
             dlg.Document = pd;
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 pd.Print();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("An error occurred attempting to print the grid - " + ex.Message);
         }
     }
 }