/// <summary> /// 打印全部事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void printDocumentPre_PrintPage(object sender, PrintPageEventArgs e) { try { if (m_printInCommonView == null || m_printInCommonView.PrintInCommonTabViewList1 == null) { return; } if (m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList == null) { m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = new List <PrintInCommonItemView>(); } int PageRecordCount = iPrintNurse.PageRecordCount; //每张的行数 var PrintInCommonItemViewList = m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList; int allcount = PrintInCommonItemViewList.Count; int pageCount = (allcount + PageRecordCount - 1) / PageRecordCount; //总页数 if (pageCount == 0) { pageCount = 1; } List <PrintInCommonItemView> printInCommonItemViewEven = new List <PrintInCommonItemView>(); for (int j = printPageNowPer * PageRecordCount; j < ((printPageNowPer + 1) * PageRecordCount); j++) { if (j < allcount) { PrintInCommonItemViewList[j].RowNum = j + 1; InCommonNoteBiz.ConvertForImgRec(PrintInCommonItemViewList[j]); printInCommonItemViewEven.Add(PrintInCommonItemViewList[j]); } } InCommonNoteBiz.ConvertForDateTime(printInCommonItemViewEven); InCommonNoteBiz.SetRowEnd(printInCommonItemViewEven, m_printInCommonView.PrintFileName); RecordPrintView recordPrintView = ConvertPrintView(m_printInCommonView); recordPrintView.PrintInpatientView.ListCount = printInCommonItemViewEven.Count.ToString(); int Addpage = Convert.ToInt32(speNum.Value); recordPrintView.PrintInpatientView.CurrPage = (printPageNowPer + Addpage).ToString(); recordPrintView.PrintInCommonItemViewList = printInCommonItemViewEven; iPrintNurse.GetPreview(recordPrintView, e.Graphics); if (printPageNowPer < pageCount - 1 && printPageNowPer < printEnd - 1) { e.HasMorePages = true; printPreviewControl1.Rows += 1; printPageNowPer++; return; } else { spinEditPage.Properties.MinValue = (int)speNum.Value; spinEditPage.Properties.MaxValue = pageCount + (int)speNum.Value - 1; printPageNowPer = 0; e.HasMorePages = false; } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.Message + ex.StackTrace); } }