private void m_mthCalculationSub(TreeNode p_trnParent, DataTable p_dtbValues) { if (p_trnParent.Checked && p_trnParent.Tag != null) { DataRow[] objRowArr = p_dtbValues.Select("itemid = '" + p_trnParent.Tag.ToString() + "' and itemcontent <> '0'"); clsFlawedRecord objFlawedRecord = new clsFlawedRecord(p_trnParent.Text, objRowArr.Length); m_arlFlawed.Add(objFlawedRecord); } if (p_trnParent.Nodes.Count > 0) { foreach (TreeNode node in p_trnParent.Nodes) { m_mthCalculationSub(node, p_dtbValues); } } }
private void m_mthPrintLine(System.Drawing.Printing.PrintPageEventArgs e, ref int p_intYPos, clsFlawedRecord p_objFlawedRecord, StringFormat sf) { Pen penLine = new Pen(Color.Black); Font fntItem = new Font("宋体", 15F); Brush bruBlack = new SolidBrush(Color.Black); if (p_objFlawedRecord != null) { SizeF sz = e.Graphics.MeasureString(p_objFlawedRecord.m_strText, fntItem, m_intLeft2 - m_intLeft, sf); if (sz.Height > m_intHeight) { fntItem = new Font("宋体", 12F); } sf.Alignment = StringAlignment.Near; e.Graphics.DrawString(p_objFlawedRecord.m_strText.Replace("★", ""), fntItem, bruBlack, new Rectangle(m_intLeft, p_intYPos, m_intLeft2 - m_intLeft, m_intHeight), sf); sf.Alignment = StringAlignment.Far; fntItem = new Font("宋体", 15F); e.Graphics.DrawString(p_objFlawedRecord.m_intCount.ToString(), fntItem, bruBlack, new Rectangle(m_intLeft2, p_intYPos, m_intLeft3 - m_intLeft2, m_intHeight), sf); e.Graphics.DrawString(p_objFlawedRecord.m_StrGetPercentString, fntItem, bruBlack, new Rectangle(m_intLeft3, p_intYPos, m_intLeft + m_intWidth - m_intLeft3, m_intHeight), sf); } e.Graphics.DrawLine(penLine, m_intLeft, p_intYPos, m_intLeft, p_intYPos + m_intHeight); e.Graphics.DrawLine(penLine, m_intLeft2, p_intYPos, m_intLeft2, p_intYPos + m_intHeight); e.Graphics.DrawLine(penLine, m_intLeft3, p_intYPos, m_intLeft3, p_intYPos + m_intHeight); e.Graphics.DrawLine(penLine, m_intLeft + m_intWidth, p_intYPos, m_intLeft + m_intWidth, p_intYPos + m_intHeight); p_intYPos += m_intHeight; e.Graphics.DrawLine(penLine, m_intLeft, p_intYPos, m_intLeft + m_intWidth, p_intYPos); penLine.Dispose(); fntItem.Dispose(); bruBlack.Dispose(); }
internal void m_mthPrint(System.Drawing.Printing.PrintPageEventArgs e) { if (m_arlFlawed.Count > 0) { Brush bruBlack = new SolidBrush(Color.Black); StringFormat sf = new StringFormat(StringFormatFlags.FitBlackBox); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; Font fntTitle = new Font("黑体", 15F); e.Graphics.DrawString("出院病历缺陷分类统计表", fntTitle, bruBlack, new Rectangle(m_intLeft, 100, m_intWidth, m_intHeight), sf); if (m_intPrintPage == 1) { e.Graphics.DrawString(m_objViewer.m_dtpStart.Value.ToString("yyyy年MM月dd日") + "至" + m_objViewer.m_dtpEnd.Value.ToString("yyyy年MM月dd日") + clsFlawedRecord.m_intTotal + "份病历统计", fntTitle, bruBlack, new Rectangle(m_intLeft, 140, m_intWidth, m_intHeight), sf); } int intYPos = 190; if (m_intPrintPage != 1) { intYPos = 150; } e.Graphics.DrawLine(Pens.Black, m_intLeft, intYPos, m_intLeft + m_intWidth, intYPos); e.Graphics.DrawString("缺陷分类", fntTitle, bruBlack, new Rectangle(m_intLeft, intYPos, m_intLeft2 - m_intLeft, m_intHeight), sf); e.Graphics.DrawString("例数", fntTitle, bruBlack, new Rectangle(m_intLeft2, intYPos, m_intLeft3 - m_intLeft2, m_intHeight), sf); e.Graphics.DrawString("百分率(%)", fntTitle, bruBlack, new Rectangle(m_intLeft3, intYPos, m_intLeft + m_intWidth - m_intLeft3, m_intHeight), sf); m_mthPrintLine(e, ref intYPos, null, sf); for (int i = m_intPrintIndex; i < m_arlFlawed.Count; i++) { clsFlawedRecord obj = (clsFlawedRecord)m_arlFlawed[i]; m_mthPrintLine(e, ref intYPos, obj, sf); if ((i + 1) % 20 == 0 && i != 0) { e.Graphics.DrawString("第 " + m_intPrintPage + " 页", fntTitle, bruBlack, new Rectangle(m_intLeft3, m_intBottom, 120, m_intHeight), sf); m_intPrintPage++; e.HasMorePages = true; m_intPrintIndex++; return; } m_intPrintIndex++; } sf.Alignment = StringAlignment.Near; e.Graphics.DrawString("甲级病历", fntTitle, bruBlack, new Rectangle(m_intLeft, intYPos, m_intLeft2 - m_intLeft, m_intHeight), sf); sf.Alignment = StringAlignment.Far; e.Graphics.DrawString(clsFlawedRecord.m_intA.ToString(), fntTitle, bruBlack, new Rectangle(m_intLeft2, intYPos, m_intLeft3 - m_intLeft2, m_intHeight), sf); float flt = (float)clsFlawedRecord.m_intA / (float)clsFlawedRecord.m_intTotal * 100; string str = flt.ToString("00.0") + "%"; if (str[0] == '0') { str = str.Remove(0, 1); } e.Graphics.DrawString(str, fntTitle, bruBlack, new Rectangle(m_intLeft3, intYPos, m_intLeft + m_intWidth - m_intLeft3, m_intHeight), sf); m_mthPrintLine(e, ref intYPos, null, sf); sf.Alignment = StringAlignment.Near; e.Graphics.DrawString("乙级病历", fntTitle, bruBlack, new Rectangle(m_intLeft, intYPos, m_intLeft2 - m_intLeft, m_intHeight), sf); sf.Alignment = StringAlignment.Far; e.Graphics.DrawString(clsFlawedRecord.m_intB.ToString(), fntTitle, bruBlack, new Rectangle(m_intLeft2, intYPos, m_intLeft3 - m_intLeft2, m_intHeight), sf); flt = (float)clsFlawedRecord.m_intB / (float)clsFlawedRecord.m_intTotal * 100; str = flt.ToString("00.0") + "%"; if (str[0] == '0') { str = str.Remove(0, 1); } e.Graphics.DrawString(str, fntTitle, bruBlack, new Rectangle(m_intLeft3, intYPos, m_intLeft + m_intWidth - m_intLeft3, m_intHeight), sf); m_mthPrintLine(e, ref intYPos, null, sf); if (intYPos < m_intBottom) { intYPos = m_intBottom; } else { intYPos += 10; } sf.Alignment = StringAlignment.Center; e.Graphics.DrawString("第 " + m_intPrintPage + " 页", fntTitle, bruBlack, new Rectangle(m_intLeft3, intYPos, 120, m_intHeight), sf); e.HasMorePages = false; fntTitle.Dispose(); bruBlack.Dispose(); sf.Dispose(); } }