/// <summary> /// 套打-全部6张(F1) /// 套打-机动车驾驶培训记录*3(F2)(完成) /// 套打-机动车驾驶人身体条件证明(F3)(开发区完成) /// 套打-机动车驾驶员培训学员登记表(F4)(完成) /// 套打-科目三考试成绩表(F5)(完成) /// 套打-机动车驾驶证申请表F6 /// 直接打-驾驶证申请表F7 /// 套打-结业证F8 /// void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { int i = this.dataGridView1.SelectedRows[0].Index; StudentInfo student = this.pager.Lists[i] as StudentInfo; BaseStudentPrinter printer = null; if (e.KeyCode == Keys.F1) { printer = new AllPrinter(student); } else if (e.KeyCode == Keys.F2) { printer = new F2Printer(student); } else if (e.KeyCode == Keys.F3) { printer = new F3Printer(student); } else if (e.KeyCode == Keys.F4) { printer = new F4Printer(student); } else if (e.KeyCode == Keys.F5) { printer = new F5Printer(student); //printer = new F5Printer(this.student); } else if (e.KeyCode == Keys.F6) { this.SetPrinted(student); printer = new ApplyPrinter(student); } else if (e.KeyCode == Keys.F7) { this.SetPrinted(student); printer = new ApplyExcelPrinter(student); ApplyExcelPrinter tmp = printer as ApplyExcelPrinter; tmp.PrintExcel(false); return; } else if (e.KeyCode == Keys.F8) { printer = new F8Printer(student); } else if (e.KeyCode == Keys.F9) { printer = new F9Printer(student); } if (printer != null) { this.Print(printer); //commonPrinter.ShowPreviewPrinter(); } } //throw new Exception("The method or operation is not implemented."); }
public static void Print(StudentInfo student, Keys key) { BaseStudentPrinter printer = null; if (key == Keys.F1) { printer = new AllPrinter(student); } else if (key == Keys.F2) { printer = new F2Printer(student); } else if (key == Keys.F3) { printer = new F3Printer(student); } else if (key == Keys.F4) { printer = new F4Printer(student); } else if (key == Keys.F5) { printer = new F5Printer(student); //printer = new F5Printer(this.student); } else if (key == Keys.F6) { SetPrinted(student); printer = new ApplyPrinter(student); } else if (key == Keys.F7) { SetPrinted(student); printer = new ApplyExcelPrinter(student); ApplyExcelPrinter tmp = printer as ApplyExcelPrinter; tmp.PrintExcel(false); return; } else if (key == Keys.F8) { printer = new F8Printer(student); } else if (key == Keys.F9) { printer = new F9Printer(student); } if (printer != null) { CommonPrinter commonPrinter = new CommonPrinter(printer); //commonPrinter.ShowPreviewPrinter(); GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>(); if (printSetting.PrintModel == "直接打") { commonPrinter.Print(); } else if (printSetting.PrintModel == "选择打印机") { commonPrinter.ShowPreviewPrinter(); } else { commonPrinter.Preview(); } } }