public frmTJSYSPXX(string strZLBH) { this.InitializeComponent(); clsMe clsMe = new clsMe(); clsMe.setFormStyl(this); clsStr clsStr = new clsStr(); clsCommon clsCommon = new clsCommon(); this.initT14(); DataRow[] array = this.dsT14.Tables["t14"].Select("BH='" + strZLBH + "'"); this.lblQYMC.Text = array[0]["QYMC"].ToString() + ":"; this.strCPMC = array[0]["CPMC"].ToString(); this.strCPBM = array[0]["CPBM"].ToString(); DataTable dataTable = new DataTable(); dataTable.TableName = "Result"; dataTable.Columns.Add("ZW"); dataTable.Columns.Add("FZDX"); dataTable.Columns.Add("SPZT"); string[] array2 = clsStr.Seperate(array[0]["ZW"].ToString(), '|'); string[] array3 = clsStr.Seperate(array[0]["FZDX"].ToString(), '|'); string[] array4 = clsStr.Seperate(array[0]["SPZT"].ToString(), '|'); for (int i = 0; i < array2.Length; i++) { if (!(array2[i].ToString() == "") || !(array3[i].ToString() == "")) { DataRow dataRow = dataTable.NewRow(); dataRow["ZW"] = array2[i]; dataRow["FZDX"] = array3[i]; string text = array4[i]; if (text != null) { if (text == "1") { dataRow["SPZT"] = "同意"; } } dataTable.Rows.Add(dataRow); } } this.grvZWFZDXSPXX.DataSource = dataTable; }
private void btnSearch_Click(object sender, EventArgs e) { this.SetHeaders(this.GetHeaderType()); this.SetGridControl(this.GetHeaderType()); clsStr clsStr = new clsStr(); this.Cursor = Cursors.WaitCursor; string text = ""; if (this.txtDWMC.Text.Trim() != "") { if (text == "") { text = "SYDW like '%" + this.txtDWMC.Text.Trim() + "%'"; } else { text = text + " and SYDW like '%" + this.txtDWMC.Text.Trim() + "%'"; } } if (this.txtLXR.Text.Trim() != "") { if (text == "") { text = "LXR like '%" + this.txtLXR.Text.Trim() + "%'"; } else { text = text + " and LXR like '%" + this.txtLXR.Text.Trim() + "%'"; } } if (this.txtAddress.Text.Trim() != "") { if (text == "") { text = "DWDZ like '%" + this.txtAddress.Text.Trim() + "%'"; } else { text = text + " and DWDZ like '%" + this.txtAddress.Text.Trim() + "%'"; } } clsCommon clsCommon = new clsCommon(); this.tblSYDW.Rows.Clear(); this.tblSYDW.Columns.Clear(); this.tblSYDW = clsCommon.GetFile(this.GetHeaderType()); DataRow[] array = this.tblSYDW.Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array.Length; i++) { DataRow dataRow = dataTable.NewRow(); if (this.radSC.Checked) { dataRow["SYDW"] = array[i]["SYDW"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YZBM"] = array[i]["YZBM"]; dataRow["LXR"] = array[i]["LXR"]; dataRow["tel"] = array[i]["tel"]; } else { if (this.radCL.Checked) { dataRow["SYDW"] = array[i]["SYDW"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["tel"] = array[i]["tel"]; } else { if (this.radDL.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["tel"] = array[i]["tel"]; dataRow["JD"] = array[i]["JD"]; } else { if (this.radHJ.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["tel"] = array[i]["tel"]; dataRow["SYXM"] = array[i]["SYXM"]; } else { if (this.radQFX.Checked) { dataRow["DWMC"] = array[i]["DWMC"]; dataRow["DWDZ"] = array[i]["DWDZ"]; dataRow["YB"] = array[i]["YB"]; dataRow["LXR"] = array[i]["LXR"]; dataRow["tel"] = array[i]["tel"]; dataRow["email"] = array[i]["email"]; } } } } } dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtDWMC.Focus(); } }
private void picLeft00_Click(object sender, EventArgs e) { clsCommon clsCommon = new clsCommon(); clsCommon.RunProcess(((PictureBox)sender).Tag.ToString()); }
private void navBarItemLinkClicked(object sender, NavBarLinkEventArgs e) { string a = e.Link.Caption.ToString().Trim(); this.Cursor = Cursors.WaitCursor; if (a == "农药登记查询") { frmNY frm = new frmNY(); this.OpenFrm(frm); } if (a == "生产企业=>农药") { frmQY2NY frm2 = new frmQY2NY(); this.OpenFrm(frm2); } if (a == "作物对象=>农药") { frmZWFZDX2NY frm3 = new frmZWFZDX2NY(); this.OpenFrm(frm3); } if (a == "农药单混剂查询") { frmNYDHJ frm4 = new frmNYDHJ(); this.OpenFrm(frm4); } if (a == "临时转正式") { frmLS2ZS frm5 = new frmLS2ZS(); this.OpenFrm(frm5); } if (a == "农药新命名规则") { frmNewDJMC frm6 = new frmNewDJMC(); this.OpenFrm(frm6); } if (a == "农药有效性查询") { frmNYUsed frm7 = new frmNYUsed(); this.OpenFrm(frm7); } if (a == "过期产品查询") { frmNYUnused frm8 = new frmNYUnused(); this.OpenFrm(frm8); } if (a == "农药标签信息查询") { frmBQ frm9 = new frmBQ(); this.OpenFrm(frm9); } if (a == "禁限用查询") { frmJXY frm10 = new frmJXY(); this.OpenFrm(frm10); } if (a == "农药受理查询") { frmSLCP frm11 = new frmSLCP(); this.OpenFrm(frm11); } if (a == "生产企业查询") { frmQY frm12 = new frmQY(); this.OpenFrm(frm12); } if (a == "农药单位查询") { frmDW frm13 = new frmDW(); this.OpenFrm(frm13); } if (a == "农药=>生产企业") { frmNY2QY frm14 = new frmNY2QY(); this.OpenFrm(frm14); } if (a == "试验单位查询") { frmSYDW frm15 = new frmSYDW(); this.OpenFrm(frm15); } if (a == "有效成分查询") { frmYXCF frm16 = new frmYXCF(); this.OpenFrm(frm16); } if (a == "成分=>作物对象") { frmYXCF2ZWFZDX frm17 = new frmYXCF2ZWFZDX(); this.OpenFrm(frm17); } if (a == "作物=>防治对象") { frmZW2FZDX frm18 = new frmZW2FZDX(); this.OpenFrm(frm18); } if (a == "防治对象=>作物") { frmFZDX2ZW frm19 = new frmFZDX2ZW(); this.OpenFrm(frm19); } if (a == "合理使用准则") { frmHLSYZZ frm20 = new frmHLSYZZ(); this.OpenFrm(frm20); } if (a == "中毒与急救") { frmZD2JJ frm21 = new frmZD2JJ(); this.OpenFrm(frm21); } if (a == "农药类别=>成分") { frmNYLB2YXCF frm22 = new frmNYLB2YXCF(); this.OpenFrm(frm22); } if (a == "有效成分=>剂型") { frmYXCF2JX frm23 = new frmYXCF2JX(); this.OpenFrm(frm23); } if (a == "环境毒性查询") { frmHJDX frm24 = new frmHJDX(); this.OpenFrm(frm24); } if (a == "田间试验查询") { frmTJSY frm25 = new frmTJSY(); this.OpenFrm(frm25); } if (a == "数据升级") { frmHao frmHao = new frmHao(""); frmHao.ShowDialog(); } if (a == "汇款信息") { clsCommon clsCommon = new clsCommon(); clsCommon.RunProcess(Directory.GetCurrentDirectory() + "\\account.doc"); } this.Cursor = Cursors.Default; }
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { int num = 20; int num2 = 15; int num3 = 300; int num4 = 315; int width = 745; int num5 = 11; float num6 = 100f; float num7 = 5f; int num8 = 770; int num9 = 1120; Pen pen = new Pen(Color.Black); Font font = new Font("宋体", (float)num5, FontStyle.Regular); Font font2 = new Font("宋体", 14f, FontStyle.Bold); Brush brush = new SolidBrush(Color.Black); SizeF sizeF = new SizeF(12f, 12f); RectangleF rectangleF = new RectangleF(10f, (float)num2, sizeF.Width, sizeF.Height); StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Far; e.Graphics.DrawRectangle(new Pen(Color.Black, 2f), 5, 5, num8, num9); DataRow[] array = null; DataRow focusedDataRow = this.gridView1.GetFocusedDataRow(); string str = focusedDataRow["R1"].ToString(); array = MDIParent.dsBQ.Tables["bq"].Select("R1='" + str + "'"); clsCommon clsCommon = new clsCommon(); if (array != null && array.Length == 1) { if (array[0]["R1"].ToString().Trim() == "PD20060003") { clsCommon.RunProcess("IEXPLORE.EXE", Directory.GetCurrentDirectory() + "\\lblImage\\PD20060003.jpg"); } if (array[0]["R1"].ToString().Trim() == "PD20060003F060050") { clsCommon.RunProcess("IEXPLORE.EXE", Directory.GetCurrentDirectory() + "\\lblImage\\PD20060003F060050.jpg"); } if (array[0]["R1"].ToString().Trim() == "PD20060033") { clsCommon.RunProcess("IEXPLORE.EXE", Directory.GetCurrentDirectory() + "\\lblImage\\PD20060033.jpg"); } if (array[0]["R1"].ToString().Trim() == "PD20060033F060051") { clsCommon.RunProcess("IEXPLORE.EXE", Directory.GetCurrentDirectory() + "\\lblImage\\PD20060033F060051.jpg"); } if (array[0]["R1"].ToString().Trim() != "PD20060003" && array[0]["R1"].ToString().Trim() != "PD20060003F060050" && array[0]["R1"].ToString().Trim() != "PD20060033" && array[0]["R1"].ToString().Trim() != "PD20060033F060051") { DataRow[] array2 = MDIParent.dsP.Tables["P"].Select("R1='" + array[0]["R1"].ToString() + "'"); DataRow[] array3 = null; if (array2.Length == 1) { array3 = MDIParent.dsF.Tables["F"].Select("F2='" + array2[0]["F2"].ToString() + "'"); } if (array2.Length > 0 && array3.Length > 0) { rectangleF.X = (float)num; rectangleF.Y = (float)num2; if (this.intPageNum == 1) { stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; if (array2[0]["R12"].ToString().IndexOf("鼠") >= 0) { sizeF = e.Graphics.MeasureString("防伪标识", font2); rectangleF.Width = 250f; rectangleF.Height = 54f + num7; e.Graphics.DrawString("防伪标识", font2, brush, rectangleF, stringFormat); } else { sizeF = e.Graphics.MeasureString(array[0]["B6"].ToString(), font2); rectangleF.Width = 250f; rectangleF.Height = 54f + num7; e.Graphics.DrawString(array[0]["B6"].ToString(), font2, brush, rectangleF, stringFormat); } stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Far; rectangleF.X = (float)num3; if (array[0]["R1"].ToString().IndexOf("L") >= 0) { sizeF = e.Graphics.MeasureString("农药临时登记证号:" + array[0]["R1"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("农药临时登记证号:" + array[0]["R1"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString("农药登记证号:" + array[0]["R1"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("农药登记证号:" + array[0]["R1"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } sizeF = e.Graphics.MeasureString("农药生产许可证(或生产批准文件)号:", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("农药生产许可证(或生产批准文件)号:", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString("产品标准号:", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("产品标准号:", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; stringFormat.Alignment = StringAlignment.Center; sizeF = e.Graphics.MeasureString("\r\n" + array2[0]["R2"].ToString(), font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("\r\n" + array2[0]["R2"].ToString(), font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; if (array2[0]["R7"].ToString().Trim().IndexOf('、') < 0) { if (array[0]["R1"].ToString().IndexOf("W") >= 0) { sizeF = e.Graphics.MeasureString(array2[0]["E2"].ToString() + array2[0]["R7"].ToString(), font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(array2[0]["E2"].ToString() + array2[0]["R7"].ToString(), font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString("有效成分含量:" + array2[0]["R7"].ToString(), font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("有效成分含量:" + array2[0]["R7"].ToString(), font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } } else { string[] array4 = array2[0]["E2"].ToString().Split(new char[] { '、' }); string[] array5 = array2[0]["R7"].ToString().Split(new char[] { '、' }); string text = ""; for (int i = 0; i < array4.Length; i++) { if (text == "") { text = array4[i] + "含量" + array5[i]; } else { string text2 = text; text = string.Concat(new string[] { text2, "\r\n", array4[i], "含量", array5[i] }); } } if (text == "") { sizeF = e.Graphics.MeasureString("总有效成分含量:" + array2[0]["HL"].ToString(), font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("总有效成分含量:" + array2[0]["HL"].ToString(), font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString("总有效成分含量:" + array2[0]["HL"].ToString() + "\r\n" + text, font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("总有效成分含量:" + array2[0]["HL"].ToString() + "\r\n" + text, font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } } if (array[0]["R1"].ToString().IndexOf("W") < 0) { sizeF = e.Graphics.MeasureString("剂型:" + array2[0]["R13"].ToString(), font2); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("剂型:" + array2[0]["R13"].ToString(), font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } if (array2[0]["R11"].ToString().Trim() == "低毒") { try { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx3.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } catch { } } else { try { string text3 = array2[0]["R11"].ToString(); if (text3 != null) { if (!(text3 == "低毒(原药高毒)")) { if (!(text3 == "中等毒")) { if (!(text3 == "中等毒(原药高毒)")) { if (!(text3 == "中等毒(原药剧毒)")) { if (!(text3 == "高毒")) { if (text3 == "剧毒") { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx1.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } else { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx1.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } else { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx2.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } else { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx2.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } else { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx2.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } else { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/dx3.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } } } catch { } sizeF = e.Graphics.MeasureString("\r\n", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("\r\n", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; brush = new SolidBrush(Color.Red); font = new Font("宋体", (float)num5, FontStyle.Bold); if (array2[0]["R11"].ToString().IndexOf("(") >= 0) { if (array2[0]["R11"].ToString() != "低毒(原药高毒)") { sizeF = e.Graphics.MeasureString(array2[0]["R11"].ToString().Substring(0, array2[0]["R11"].ToString().IndexOf('(')) + "\r\n", font); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(array2[0]["R11"].ToString().Substring(0, array2[0]["R11"].ToString().IndexOf('(')) + "\r\n", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } sizeF = e.Graphics.MeasureString(array2[0]["R11"].ToString().Substring(array2[0]["R11"].ToString().IndexOf('(')), font); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(array2[0]["R11"].ToString().Substring(array2[0]["R11"].ToString().IndexOf('(')), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString(array2[0]["R11"].ToString(), font); rectangleF.Width = (float)num4; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(array2[0]["R11"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } brush = new SolidBrush(Color.Black); font = new Font("宋体", (float)num5, FontStyle.Regular); } if (array2[0]["R12"].ToString().IndexOf("鼠") >= 0) { try { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/mouse.JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImageUnscaled(image, Convert.ToInt32(rectangleF.Left) + Convert.ToInt32((double)num4 / 2.5), Convert.ToInt32(rectangleF.Top)); rectangleF.Y += rectangleF.Height; } catch { } } stringFormat.Alignment = StringAlignment.Near; rectangleF.X = (float)num; string[] array6 = array2[0]["C2"].ToString().Split(new char[] { '|' }); string[] array7 = array2[0]["T2"].ToString().Split(new char[] { '|' }); string[] array8 = array2[0]["R15"].ToString().Split(new char[] { '|' }); string[] array9 = array2[0]["R14"].ToString().Split(new char[] { '|' }); float num10 = 0f; float num11 = 0f; float num12 = 0f; float num13 = 0f; bool flag = false; for (int j = 0; j < array6.Length; j++) { if (array6.Length == 1 && array6[0] == "") { break; } flag = true; if (j == 0) { sizeF = e.Graphics.MeasureString("\r\n使用技术和使用方法:", font2); rectangleF.Width = sizeF.Width + num6; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("\r\n使用技术和使用方法:", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; rectangleF.X = (float)num; sizeF = e.Graphics.MeasureString("作物(或范围)", font); rectangleF.Width = sizeF.Width + num6; num10 = rectangleF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString("作物(或范围)", font, brush, rectangleF, stringFormat); rectangleF.X += rectangleF.Width; sizeF = e.Graphics.MeasureString("防治对象", font); rectangleF.Width = sizeF.Width + num6; num11 = rectangleF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString("防治对象", font, brush, rectangleF, stringFormat); rectangleF.X += rectangleF.Width; sizeF = e.Graphics.MeasureString("制剂用药量", font); rectangleF.Width = sizeF.Width + num6; num12 = rectangleF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString("制剂用药量", font, brush, rectangleF, stringFormat); rectangleF.X += rectangleF.Width; sizeF = e.Graphics.MeasureString("使用方法", font); rectangleF.Width = sizeF.Width + num6; num13 = rectangleF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString("使用方法", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array6[j], font, Convert.ToInt32(num10)); float height = sizeF.Height; sizeF = e.Graphics.MeasureString(array7[j], font, Convert.ToInt32(num11)); if (sizeF.Height > height) { height = sizeF.Height; } sizeF = e.Graphics.MeasureString(array8[j], font, Convert.ToInt32(num12)); if (sizeF.Height > height) { height = sizeF.Height; } sizeF = e.Graphics.MeasureString(array9[j], font, Convert.ToInt32(num13)); if (sizeF.Height > height) { height = sizeF.Height; } if (height > e.Graphics.MeasureString("车", font).Height) { stringFormat.LineAlignment = StringAlignment.Center; } else { stringFormat.LineAlignment = StringAlignment.Far; } rectangleF.X = (float)num; rectangleF.Width = num10; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array6[j], font, brush, rectangleF, stringFormat); rectangleF.X += num10; rectangleF.Width = num11; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array7[j], font, brush, rectangleF, stringFormat); rectangleF.X += num11; rectangleF.Width = num12; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array8[j], font, brush, rectangleF, stringFormat); rectangleF.X += num12; rectangleF.Width = num13; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array9[j], font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString(array6[j], font, Convert.ToInt32(num10)); float height = sizeF.Height; sizeF = e.Graphics.MeasureString(array7[j], font, Convert.ToInt32(num11)); if (sizeF.Height > height) { height = sizeF.Height; } sizeF = e.Graphics.MeasureString(array8[j], font, Convert.ToInt32(num12)); if (sizeF.Height > height) { height = sizeF.Height; } sizeF = e.Graphics.MeasureString(array9[j], font, Convert.ToInt32(num13)); if (sizeF.Height > height) { height = sizeF.Height; } if (height > e.Graphics.MeasureString("车", font).Height) { stringFormat.LineAlignment = StringAlignment.Center; } else { stringFormat.LineAlignment = StringAlignment.Far; } rectangleF.X = (float)num; rectangleF.Width = num10; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array6[j], font, brush, rectangleF, stringFormat); rectangleF.X += num10; rectangleF.Width = num11; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array7[j], font, brush, rectangleF, stringFormat); rectangleF.X += num11; rectangleF.Width = num12; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array8[j], font, brush, rectangleF, stringFormat); rectangleF.X += num12; rectangleF.Width = num13; rectangleF.Height = height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top, rectangleF.Width, rectangleF.Height); e.Graphics.DrawString(array9[j], font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } } stringFormat.LineAlignment = StringAlignment.Far; rectangleF.X = (float)num; float num14 = 0f; if (flag) { if (array[0]["R1"].ToString().IndexOf("W") < 0) { font = new Font("华文仿宋", 9f, FontStyle.Regular); sizeF = e.Graphics.MeasureString("(注:(1)公顷用制剂量=亩用制剂量×15\r\n (2)总有效成分量浓度值(毫克/千克)=(制剂含量×1000000)÷制剂稀释倍数)", font, Convert.ToInt32(num10 + num11 + num12 + num13)); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("(注:(1)公顷用制剂量=亩用制剂量×15\r\n (2)总有效成分量浓度值(毫克/千克)=(制剂含量×1000000)÷制剂稀释倍数)", font, brush, rectangleF, stringFormat); font = new Font("宋体", (float)num5, FontStyle.Regular); rectangleF.Y += rectangleF.Height; num14 = rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B5"].ToString(), font, Convert.ToInt32(num10 + num11 + num12 + num13)); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top - num14, (float)Convert.ToInt32(num10 + num11 + num12 + num13), rectangleF.Height + num14); e.Graphics.DrawString(array[0]["B5"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString(array[0]["B5"].ToString(), font, Convert.ToInt32(num10 + num11 + num12 + num13)); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawRectangle(pen, rectangleF.Left, rectangleF.Top - num14, (float)Convert.ToInt32(num10 + num11 + num12 + num13), rectangleF.Height + num14); e.Graphics.DrawString(array[0]["B5"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } } if (!flag && array[0]["B5"].ToString().Trim() != "") { sizeF = e.Graphics.MeasureString("\r\n使用技术和使用方法:", font2); rectangleF.Width = sizeF.Width + num6; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("\r\n使用技术和使用方法:", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B5"].ToString(), font, width); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString(array[0]["B5"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } if (array[0]["R1"].ToString().IndexOf("F") >= 0) { sizeF = e.Graphics.MeasureString("分装企业名称:" + array3[0]["F2"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("分装企业名称:" + array3[0]["F2"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString("生产企业名称:" + array3[0]["F2"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString("生产企业名称:" + array3[0]["F2"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } sizeF = e.Graphics.MeasureString(string.Concat(new string[] { "地址:", array3[0]["F4"].ToString(), array3[0]["F5"].ToString(), array3[0]["F6"].ToString(), array3[0]["F7"].ToString(), "邮编:", array3[0]["F11"].ToString() }), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(string.Concat(new string[] { "地址:", array3[0]["F4"].ToString(), array3[0]["F5"].ToString(), array3[0]["F6"].ToString(), array3[0]["F7"].ToString(), "邮编:", array3[0]["F11"].ToString() }), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(string.Concat(new string[] { "电话:", array3[0]["F9"].ToString(), " 传真:", array3[0]["F10"].ToString(), " 网址:", array3[0]["F13"].ToString() }), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(string.Concat(new string[] { "电话:", array3[0]["F9"].ToString(), " 传真:", array3[0]["F10"].ToString(), " 网址:", array3[0]["F13"].ToString() }), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; if (array[0]["R1"].ToString().IndexOf("W") < 0) { string text4 = "#FFFFFF"; string a = "0"; string text3 = array2[0]["R12"].ToString(); switch (text3) { case "杀鼠剂": text4 = "#0000FF"; break; case "杀虫剂": text4 = "#FF0000"; break; case "杀螨剂": text4 = "#FF0000"; break; case "杀螺剂": text4 = "#FF0000"; break; case "杀菌剂": text4 = "#000000"; break; case "杀线虫剂": text4 = "#000000"; break; case "除草剂": text4 = "#00FF00"; break; case "植物生长调节剂": text4 = "#FFCC00"; break; case "杀虫剂/杀螨剂": text4 = "#FF0000"; break; case "杀螨剂/杀虫剂": text4 = "#FF0000"; break; case "杀虫剂/杀菌剂": text4 = "#000000"; a = "1"; break; case "杀线虫剂/杀菌剂": text4 = "#000000"; break; case "杀虫剂/卫生杀虫剂": text4 = "#FF0000"; break; case "昆虫生长调节剂": text4 = "#FF0000"; break; case "除草剂/植物生长调节剂": a = "1"; break; case "杀菌剂/杀虫剂": a = "1"; break; case "杀螨剂/杀菌剂": a = "1"; break; case "杀菌剂/植物生长调节剂": a = "1"; break; case "杀虫剂/杀线虫剂": a = "1"; break; } rectangleF.Width = (float)(num8 - num); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; ColorConverter colorConverter = new ColorConverter(); if (a == "0") { sizeF = e.Graphics.MeasureString(array2[0]["R12"].ToString(), font); rectangleF.Height = sizeF.Height + num7; rectangleF.Y = (float)num9 - rectangleF.Height; if (text4 == "#000000") { brush = new SolidBrush(Color.White); e.Graphics.FillRectangle(new SolidBrush((Color)colorConverter.ConvertFromString(text4)), rectangleF); rectangleF.Y += 2f; e.Graphics.DrawString(array2[0]["R12"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y -= 2f; brush = new SolidBrush(Color.Black); } else { e.Graphics.FillRectangle(new SolidBrush((Color)colorConverter.ConvertFromString(text4)), rectangleF); rectangleF.Y += 2f; e.Graphics.DrawString(array2[0]["R12"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y -= 2f; } } else { string text5 = "#000000"; string text6 = "#000000"; string text7 = "#000000"; string text8 = ""; string text9 = ""; text3 = array2[0]["R12"].ToString(); if (text3 != null) { if (!(text3 == "杀虫剂/杀菌剂")) { if (!(text3 == "除草剂/植物生长调节剂")) { if (!(text3 == "杀菌剂/杀虫剂")) { if (!(text3 == "杀螨剂/杀菌剂")) { if (!(text3 == "杀菌剂/植物生长调节剂")) { if (text3 == "杀虫剂/杀线虫剂") { text8 = "杀虫剂"; text4 = "#FF0000"; text6 = "#000000"; text9 = "杀线虫剂"; text5 = "#000000"; text7 = "#FFFFFF"; } } else { text8 = "杀菌剂"; text4 = "#000000"; text6 = "#FFFFFF"; text9 = "植物生长调节剂"; text5 = "#FFFF00"; text7 = "#000000"; } } else { text8 = "杀螨剂"; text4 = "#FF0000"; text6 = "#000000"; text9 = "杀菌剂"; text5 = "#000000"; text7 = "#FFFFFF"; } } else { text8 = "杀菌剂"; text4 = "#000000"; text6 = "#FFFFFF"; text9 = "杀虫剂"; text5 = "#FF0000"; text7 = "#000000"; } } else { text8 = "除草剂"; text4 = "#00FF00"; text6 = "#000000"; text9 = "植物生长调节剂"; text5 = "#FFFF00"; text7 = "#000000"; } } else { text8 = "杀虫剂"; text4 = "#FF0000"; text6 = "#000000"; text9 = "杀菌剂"; text5 = "#000000"; text7 = "#FFFFFF"; } } sizeF = e.Graphics.MeasureString(text9, font); rectangleF.Height = sizeF.Height + num7; rectangleF.Y = (float)num9 - rectangleF.Height; brush = new SolidBrush((Color)colorConverter.ConvertFromString(text7)); e.Graphics.FillRectangle(new SolidBrush((Color)colorConverter.ConvertFromString(text5)), rectangleF); rectangleF.Y += 2f; e.Graphics.DrawString(text9, font, brush, rectangleF, stringFormat); rectangleF.Y -= 2f; sizeF = e.Graphics.MeasureString(text8, font); rectangleF.Height = sizeF.Height; rectangleF.Y -= rectangleF.Height; brush = new SolidBrush((Color)colorConverter.ConvertFromString(text6)); e.Graphics.FillRectangle(new SolidBrush((Color)colorConverter.ConvertFromString(text4)), rectangleF); rectangleF.Y += 2f; e.Graphics.DrawString(text8, font, brush, rectangleF, stringFormat); rectangleF.Y -= 2f; brush = new SolidBrush(Color.Black); } stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Far; } this.intPageNum = 2; e.HasMorePages = true; } else { if (this.intPageNum == 2) { sizeF = e.Graphics.MeasureString("产品性能(用途):", font2); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("产品性能(用途):", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B1"].ToString(), font, width); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString(array[0]["B1"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString("注意事项:", font2); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("注意事项:", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B2"].ToString(), font, width); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString(array[0]["B2"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString("中毒急救:", font2); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("中毒急救:", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B3"].ToString(), font, width); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString(array[0]["B3"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString("储存和运输:", font2); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("储存和运输:", font2, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; sizeF = e.Graphics.MeasureString(array[0]["B4"].ToString(), font, width); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height + num7; e.Graphics.DrawString(array[0]["B4"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; if (array[0]["B8"].ToString().Trim() != "") { sizeF = e.Graphics.MeasureString(array[0]["B8"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(array[0]["B8"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } if (array[0]["R1"].ToString().IndexOf("F") >= 0) { string text10 = array[0]["R1"].ToString().Substring(0, array[0]["R1"].ToString().IndexOf("F")); if (text10.Substring(text10.Length - 1) == "-") { text10 = text10.Substring(0, text10.Length - 1); } DataRow[] array10 = MDIParent.dsP.Tables["P"].Select("R1='" + text10 + "'"); DataRow[] array11 = null; if (array10.Length == 1) { array11 = MDIParent.dsF.Tables["F"].Select("F2='" + array10[0]["F2"].ToString() + "'"); } if (array11.Length == 1 && array10.Length == 1) { sizeF = e.Graphics.MeasureString(string.Concat(new string[] { "原大包装生产企业:", array11[0]["F2"].ToString(), " 登记证号:", text10, "\r\n地址:", array11[0]["F4"].ToString(), array11[0]["F5"].ToString(), array11[0]["F6"].ToString(), array11[0]["F7"].ToString(), " 邮编:", array11[0]["F11"].ToString(), "\r\n电话:", array11[0]["F9"].ToString(), " 传真:", array11[0]["F10"].ToString(), "\r\n生产许可证或农药生产批准文件号: 生产日期和批号:" }), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString(string.Concat(new string[] { "原大包装生产企业:", array11[0]["F2"].ToString(), " 登记证号:", text10, "\r\n地址:", array11[0]["F4"].ToString(), array11[0]["F5"].ToString(), array11[0]["F6"].ToString(), array11[0]["F7"].ToString(), " 邮编:", array11[0]["F11"].ToString(), "\r\n电话:", array11[0]["F9"].ToString(), " 传真:", array11[0]["F10"].ToString(), "\r\n生产许可证或农药生产批准文件号: 生产日期和批号:" }), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } else { sizeF = e.Graphics.MeasureString("原大包装生产企业: 登记证号:\r\n地址: 邮编:\r\n电话: 传真:\r\n生产许可证或农药生产批准文件号: 生产日期和批号:", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("原大包装生产企业: 登记证号:\r\n地址: 邮编:\r\n电话: 传真:\r\n生产许可证或农药生产批准文件号: 生产日期和批号:", font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; } sizeF = e.Graphics.MeasureString("\r\n净含量(重量): 毫升(克) 分装日期: 年 月 日 批号: ", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("\r\n净含量(重量): 毫升(克) 分装日期: 年 月 日 批号: ", font, brush, rectangleF, stringFormat); rectangleF.X += rectangleF.Width; } else { sizeF = e.Graphics.MeasureString("\r\n净含量(重量): 毫升(克) 生产日期: 年 月 日 批号: ", font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("\r\n净含量(重量): 毫升(克) 生产日期: 年 月 日 批号: ", font, brush, rectangleF, stringFormat); rectangleF.X += rectangleF.Width; } sizeF = e.Graphics.MeasureString("\r\n有效期:" + array[0]["B9"].ToString(), font); rectangleF.Width = sizeF.Width; rectangleF.Height = sizeF.Height; e.Graphics.DrawString("\r\n有效期:" + array[0]["B9"].ToString(), font, brush, rectangleF, stringFormat); rectangleF.Y += rectangleF.Height; if (array[0]["R1"].ToString().IndexOf("W") < 0) { string[] array12 = array[0]["B7"].ToString().Split(new char[] { '/' }); rectangleF.Y = (float)(num9 - 40); rectangleF.X = (float)(num8 - 40 * array12.Length); for (int k = 0; k < array12.Length; k++) { try { Image image = Image.FromFile(Directory.GetCurrentDirectory() + "/lblImage/" + array12[k] + ".JPG"); rectangleF.Width = (float)image.Width; rectangleF.Height = (float)image.Height; e.Graphics.DrawImage(image, Convert.ToInt32(rectangleF.Left), Convert.ToInt32(rectangleF.Top), 40, 40); rectangleF.X += 40f; } catch { } } } } } } } } }
private void btnSearch_Click(object sender, EventArgs e) { clsStr clsStr = new clsStr(); clsCommon clsCommon = new clsCommon(); this.Cursor = Cursors.WaitCursor; string text = ""; string[] array = clsStr.Seperate(this.txtYXCF.Text.Replace("%", "[%]"), ' '); string text2 = ""; for (int i = 0; i < array.Length; i++) { if (!(array[i] == "")) { if (text2 == "") { text2 = "c1 like '%" + array[i] + "%'"; } else { text2 = text2 + " or c1 like '%" + array[i] + "%'"; } } } if (text2 != "") { if (text == "") { text = "(" + text2 + ")"; } else { text = text + " and (" + text2 + ")"; } } DataRow[] array2 = clsCommon.GetFileData("SYZZ").Select(text); DataTable dataTable = new DataTable(); dataTable = this.tblResult.Clone(); for (int i = 0; i < array2.Length; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["c1"] = array2[i]["c1"]; dataRow["c2"] = array2[i]["c2"]; dataRow["c3"] = array2[i]["c3"]; dataRow["c4"] = array2[i]["c4"]; dataRow["c5"] = array2[i]["c5"]; dataRow["c6"] = array2[i]["c6"]; dataRow["c7"] = array2[i]["c7"]; dataRow["c8"] = array2[i]["c8"]; dataRow["c9"] = array2[i]["c9"]; dataRow["c10"] = array2[i]["c10"]; dataRow["c11"] = array2[i]["c11"]; dataTable.Rows.Add(dataRow); } this.tblResult = dataTable.Copy(); DataView dataSource = new DataView(this.tblResult); this.gridControl1.DataSource = dataSource; this.Cursor = Cursors.Default; if (this.tblResult.Rows.Count == 0) { MessageBox.Show(this, "查询不到相关数据!\r\n请您重新输入简单正确条件后继续查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtYXCF.Focus(); } }
private void frmNewDJMC_Load(object sender, EventArgs e) { clsCommon clsCommon = new clsCommon(); this.tblDJMC = clsCommon.GetFile("NewDJMC"); this.tblResult.TableName = "Result"; this.SetHeaders(); this.btnSearch_Click(null, null); this.txtYXCF1.Focus(); }