Exemplo n.º 1
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);
     }
 }