private void btn_Print_Click(object sender, EventArgs e) { //hides print button btn_Print.Visible = false; //prints form PrintForm1.Print(); //makes button visible after printing btn_Print.Visible = true; }
private void tabcontrol_SelectedPageChanged(object sender, TabPageChangedEventArgs e) { if (tabcontrol.SelectedTabPage != tabPagePrint) { return; } WaitDialogForm waitDialog = new WaitDialogForm("正在组织打印数据……", "请稍等。"); try { PrintInCommonView printInCommonView = ConvertPrintEntity(); iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName); SetWaitDialogCaption("正在绘制预览界面……", waitDialog); if (iPrintNurse != null && iPrintNurse.IsCustomPrint == true) { tabPagePrint.Controls.Clear(); PrintForm1 printForm1 = new PrintForm1(printInCommonView); printForm1.Dock = DockStyle.Fill; printForm1.TopLevel = false; printForm1.FormBorderStyle = FormBorderStyle.None; printForm1.Show(); tabPagePrint.Controls.Add(printForm1); } else { if (ucPrintRecord == null) { ucPrintRecord = new UCPrintRecord(); tabPagePrint.Controls.Add(ucPrintRecord); ucPrintRecord.Dock = DockStyle.Fill; } ucPrintRecord.LoadPrint(printInCommonView); } waitDialog.Hide(); waitDialog.Close(); } catch (Exception ex) { waitDialog.Hide(); waitDialog.Close(); YiDanCommon.Ctrs.DLG.YiDanMessageBox.Show(ex.Message); } }