/// <summary>
 /// 打印预览按钮事件
 /// </summary>
 private void previewBtn_Click(object sender, EventArgs e)
 {
     try
     {
         Tools.PrintService print = new Tools.PrintService((DataTable)queryDataGridView.DataSource);
         print.PrintPreview(); //显示打印预览
         Focus();              //该窗体获取焦点
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 打印退货清单
 /// </summary>
 private void PrintButton_Click(object sender, EventArgs e)
 {
     try
     {
         Tools.PrintService print = new Tools.PrintService((DataTable)ReturnListDataGridView.DataSource);
         if (print.PrintDataTable())//打印datagridview中的内容
         {
             MessageBox.Show("打印成功");
         }
         else
         {
             MessageBox.Show("打印失败");
         }
         Focus();//该窗体获取焦点
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void btn_Print_Click(object sender, System.EventArgs e)
 {
     try
     {
         Tools.PrintService print = new Tools.PrintService((DataTable)dataGV_showStatisticalData.DataSource);
         if (print.PrintDataTable())//打印datagridview中的内容
         {
             MessageBox.Show("打印成功");
         }
         else
         {
             MessageBox.Show("打印失败");
         }
         Focus();//该窗体获取焦点
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }