private void m_mthInitTextItem(Graphics g) { m_arrTextItem = new clsTextItem[100]; for (int i = 0; i < m_arrTextItem.Length; i++) { m_arrTextItem[i] = null; } //Row1 (0-4) m_arrTextItem[0] = new clsTextItem(c_strTitle, m_fntTitle, g); //标题 m_arrTextItem[0].SetPosition((m_fltThisWidth - m_arrTextItem[0].m_objSize.Width) / 2, m_fltRow1Top); //Row2 (5-10) m_arrTextItem[5] = new clsTextItem(c_strHospital, m_fntNormal, g); //单位 m_arrTextItem[5].SetPosition(m_fltThisWidth * 0.03f, m_fltRow2Top); m_arrTextItem[6] = new clsTextItem(m_strHospital, m_fntNormal, g); m_arrTextItem[6].SetPosition(m_fltThisWidth * 0.03f + m_arrTextItem[5].m_objSize.Width, m_fltRow2Top); m_arrLineItem[0] = new clsLineItem(m_arrTextItem[6], 3.4f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[7] = new clsTextItem(c_strLabNo, m_fntNormal, g); //实验室编号 m_arrTextItem[7].SetPosition(m_fltThisWidth * 0.46f, m_fltRow2Top); m_arrTextItem[8] = new clsTextItem(m_strLabNo, m_fntNormal, g); m_arrTextItem[8].SetPosition(m_fltThisWidth * 0.46f + m_arrTextItem[7].m_objSize.Width, m_fltRow2Top); m_arrLineItem[1] = new clsLineItem(m_arrTextItem[8], 1 * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[9] = new clsTextItem(c_strQCDate, m_fntNormal, g); //日期 m_arrTextItem[9].SetPosition(m_fltThisWidth * 0.68f, m_fltRow2Top); m_arrTextItem[10] = new clsTextItem(m_strQCDate, m_fntNormal, g); m_arrTextItem[10].SetPosition(m_fltThisWidth * 0.68f + m_arrTextItem[9].m_objSize.Width, m_fltRow2Top); //Row3 (15-30) m_arrTextItem[15] = new clsTextItem(c_strCheckItem, m_fntNormal, g); //试验项目 m_arrTextItem[15].SetPosition(m_fltThisWidth * 0.03f, m_fltRow3Top); m_arrTextItem[16] = new clsTextItem(m_strCheckItem, m_fntNormal, g); m_arrTextItem[16].SetPosition(m_fltThisWidth * 0.03f + m_arrTextItem[15].m_objSize.Width, m_fltRow3Top); m_arrLineItem[2] = new clsLineItem(m_arrTextItem[16], 1.7f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[17] = new clsTextItem(c_strMethod, m_fntNormal, g); //方法 m_arrTextItem[17].SetPosition(m_fltThisWidth * 0.28f, m_fltRow3Top); m_arrTextItem[18] = new clsTextItem(m_strMethod, m_fntNormal, g); m_arrTextItem[18].SetPosition(m_fltThisWidth * 0.28f + m_arrTextItem[17].m_objSize.Width, m_fltRow3Top); m_arrLineItem[3] = new clsLineItem(m_arrTextItem[18], 1 * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[19] = new clsTextItem(c_strDeviceType, m_fntNormal, g); //仪器型号 m_arrTextItem[19].SetPosition(m_fltThisWidth * 0.46f, m_fltRow3Top); m_arrTextItem[20] = new clsTextItem(m_strDeviceType, m_fntNormal, g); m_arrTextItem[20].SetPosition(m_fltThisWidth * 0.46f + m_arrTextItem[19].m_objSize.Width, m_fltRow3Top); m_arrLineItem[4] = new clsLineItem(m_arrTextItem[20], 1 * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[21] = new clsTextItem(c_strWaveLenth, m_fntNormal, g); //使用波长 m_arrTextItem[21].SetPosition(m_fltThisWidth * 0.68f, m_fltRow3Top); m_arrTextItem[22] = new clsTextItem(m_strWaveLenght, m_fntNormal, g); m_arrTextItem[22].SetPosition(m_fltThisWidth * 0.68f + m_arrTextItem[21].m_objSize.Width, m_fltRow3Top); m_arrLineItem[5] = new clsLineItem(m_arrTextItem[22], 0.5f * m_fltUnderLineWidth, m_fntNormal); //Row4 (31 - 40)(1 - 4) m_arrTextItem[31] = new clsTextItem(c_strQCSourceAndBatch, m_fntNormal, g); //质控物 m_arrTextItem[31].SetPosition(m_fltThisWidth * 0.03f, m_fltRow4Top); m_arrTextItem[32] = new clsTextItem(m_strQCSourceAndBatch, m_fntNormal, g); m_arrTextItem[32].SetPosition(m_fltThisWidth * 0.03f + m_arrTextItem[31].m_objSize.Width, m_fltRow4Top); m_arrLineItem[6] = new clsLineItem(m_arrTextItem[32], 2.2f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[33] = new clsTextItem(c_strChroma, m_fntNormal, g); //浓度 m_arrTextItem[33].SetPosition(m_fltThisWidth * 0.39f, m_fltRow4Top); m_arrTextItem[34] = new clsTextItem(m_strChroma, m_fntNormal, g); m_arrTextItem[34].SetPosition(m_fltThisWidth * 0.39f + m_arrTextItem[33].m_objSize.Width, m_fltRow4Top); m_arrLineItem[7] = new clsLineItem(m_arrTextItem[34], 0.6f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[35] = new clsTextItem(c_strButtValue, m_fntNormal, g); //你室测的靶值X m_arrTextItem[35].SetPosition(m_fltThisWidth * 0.49f, m_fltRow4Top); m_arrTextItem[36] = new clsTextItem(m_strRealValue_X, m_fntNormal, g); m_arrTextItem[36].SetPosition(m_fltThisWidth * 0.49f + m_arrTextItem[35].m_objSize.Width, m_fltRow4Top); m_arrLineItem[8] = new clsLineItem(m_arrTextItem[36], 0.5f * m_fltUnderLineWidth, m_fntNormal); m_arrLineItem[13] = new clsLineItem(new PointF(m_arrTextItem[35].m_objPosition.X + 92, m_arrTextItem[35].m_objPosition.Y), new PointF(m_arrTextItem[35].m_objPosition.X + 100, m_arrTextItem[35].m_objPosition.Y)); //X头的上线 m_arrTextItem[37] = new clsTextItem("s:", m_fntNormal, g); // S m_arrTextItem[37].SetPosition(m_fltThisWidth * 0.65f, m_fltRow4Top); m_arrTextItem[38] = new clsTextItem(m_strRealValue_S, m_fntNormal, g); m_arrTextItem[38].SetPosition(m_fltThisWidth * 0.65f + m_arrTextItem[37].m_objSize.Width, m_fltRow4Top); m_arrLineItem[9] = new clsLineItem(m_arrTextItem[38], 0.5f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[39] = new clsTextItem("CV:", m_fntNormal, g); //CV m_arrTextItem[39].SetPosition(m_fltThisWidth * 0.72f, m_fltRow4Top); m_arrTextItem[40] = new clsTextItem(m_strRealValue_CV, m_fntNormal, g); m_arrTextItem[40].SetPosition(m_fltThisWidth * 0.72f + m_arrTextItem[39].m_objSize.Width, m_fltRow4Top); m_arrLineItem[10] = new clsLineItem(m_arrTextItem[40], 0.5f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[1] = new clsTextItem(c_strVendorAndQCSampleLot, m_fntNormal, g); //试剂厂家及批号 m_arrTextItem[1].SetPosition(m_fltThisWidth * 0.03f, m_fltRow5Top); m_arrTextItem[2] = new clsTextItem(m_strVendorANDQCSampleLot, m_fntNormal, g); m_arrTextItem[2].SetPosition(m_fltThisWidth * 0.03f + m_arrTextItem[1].m_objSize.Width, m_fltRow5Top); m_arrLineItem[17] = new clsLineItem(m_arrTextItem[2], 1.5f * m_fltUnderLineWidth, m_fntNormal); m_arrTextItem[3] = new clsTextItem(c_strReagentExpiration, m_fntNormal, g); m_arrTextItem[3].SetPosition(m_fltThisWidth * 0.33f, m_fltRow5Top); m_arrTextItem[4] = new clsTextItem(m_strReagentExpiration, m_fntNormal, g); m_arrTextItem[4].SetPosition(m_fltThisWidth * 0.33f + m_arrTextItem[3].m_objSize.Width, m_fltRow5Top); m_arrLineItem[18] = new clsLineItem(m_arrTextItem[4], 1.5f * m_fltUnderLineWidth, m_fntNormal); //右侧 +s 坐标 (41- 60) float fltMarkX = m_objGridLeftTop.X - 30; for (int i = -3; i <= 3; i++) { float fltY = m_objButtPos.Y - i * 10 * m_fltCellHeight - 5; string strMark = (i == 0 ? c_strXChar.PadLeft(3, ' '):i.ToString().Trim().PadLeft(2, ' ') + "s"); m_arrTextItem[45 + i] = new clsTextItem(strMark, m_fntNormal, g); m_arrTextItem[45 + i].SetPosition(fltMarkX, fltY); m_arrTextItem[55 + i] = new clsTextItem(m_strMarkValue[i + 3], m_fntNormal, g); m_arrTextItem[55 + i].SetPosition(fltMarkX - 40, fltY); } m_arrLineItem[15] = new clsLineItem(new PointF(m_arrTextItem[45].m_objPosition.X + 16, m_arrTextItem[45].m_objPosition.Y), new PointF(m_arrTextItem[45].m_objPosition.X + 25, m_arrTextItem[45].m_objPosition.Y)); //X头的上线 //文本坐标 ( 61 - 69 ) fltMarkX = m_objGridLeftTop.X - 50; string[] strMarkText = new string[3] { c_strMarkDate, c_strMarkValue, c_strMarkOperator }; for (int i = 0; i < strMarkText.Length; i++) { float fltY = m_objGridLeftTop.Y + m_fltCellHeight * m_intRowCount + i * m_fltNumCellHeight + 5; m_arrTextItem[61 + i] = new clsTextItem(strMarkText[i], m_fntSmall, g); m_arrTextItem[61 + i].SetPosition(fltMarkX, fltY); } //本月数值 (70-75) float fltBottomY = m_objGridLeftTop.Y + m_fltCellHeight * m_intRowCount + m_intNumRowCount * m_fltNumCellHeight + 10; string [] strBottomText = new string[3] { c_strThisMonthX + m_strThisMonth_X, "s:" + m_strThisMonth_S, "CV:" + m_strThisMonth_CV }; for (int i = 0; i < strBottomText.Length; i++) { m_arrTextItem[70 + i] = new clsTextItem(strBottomText[i], m_fntNormal, g); m_arrTextItem[70 + i].SetPosition(m_fltThisWidth * (i + 1) / 6, fltBottomY); } SizeF objSize = g.MeasureString("本月的", m_fntNormal); m_arrLineItem[14] = new clsLineItem(new PointF(m_arrTextItem[70].m_objPosition.X + objSize.Width - 5, m_arrTextItem[70].m_objPosition.Y), new PointF(m_arrTextItem[70].m_objPosition.X + objSize.Width + 4, m_arrTextItem[70].m_objPosition.Y)); //X头的上线 //底部标题 (76- 79) m_arrTextItem[76] = new clsTextItem(c_strBottomTitle, m_fntTitle2, g); m_arrTextItem[76].SetPosition((m_fltThisWidth - m_arrTextItem[70].m_objSize.Width) / 2, fltBottomY + 30); //使用说明 ( 80 - 90 ) float fltTextX = m_objGridLeftTop.X + m_intColCount * m_fltCellWidth + m_fltCellWidth / 2; float fltTextHedith = m_fltNumCellHeight; m_arrTextItem[80] = new clsTextItem(c_strUseExplain, m_fntBigBold, g); //使用说明 m_arrTextItem[80].SetPosition(fltTextX + m_fltCellWidth, m_fltRow3Top); m_arrLineItem[11] = new clsLineItem(m_arrTextItem[80], m_arrTextItem[80].m_objSize.Width, m_fntBigBold); for (int i = 0; i < c_strExplainArr.Length; i++) { m_arrTextItem[81 + i] = new clsTextItem(c_strExplainArr[i], m_fntExplainText, g); //详细说明 m_arrTextItem[81 + i].SetPosition(fltTextX, m_objGridLeftTop.Y + fltTextHedith * i); } m_arrLineItem[16] = new clsLineItem(new PointF(m_arrTextItem[82].m_objPosition.X + 70, m_arrTextItem[82].m_objPosition.Y), new PointF(m_arrTextItem[82].m_objPosition.X + 79, m_arrTextItem[82].m_objPosition.Y)); //X头的上线 m_arrTextItem[90] = new clsTextItem(c_strLostControlReason, m_fntBigBold, g); //失控原因 m_arrTextItem[90].SetPosition(fltTextX, m_objGridLeftTop.Y + fltTextHedith * (c_strExplainArr.Length + 1)); m_arrLineItem[12] = new clsLineItem(m_arrTextItem[90], m_arrTextItem[90].m_objSize.Width, m_fntBigBold); }
public clsLineItem(clsTextItem objText, float fltWidth, Font objfnt) { m_objStart = new PointF(objText.m_objPosition.X, objText.m_objPosition.Y + objfnt.Height); m_objEnd = new PointF(objText.m_objPosition.X + fltWidth, m_objStart.Y); }