123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- using OTSCommon.Model;
- using OTSIncAReportApp.SysMgrTools;
- using OTSPeriodicTable;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
- {
- public partial class ParticlesGridDevidePageShowConfig : Form
- {
- Hashtable languageTable;
- Language lan;
- OTS_SysType_ID systype = OTS_SysType_ID.IncA;
- public ParticlesGridDevidePageShowConfig(OTS_SysType_ID a_systype)
- {
- InitializeComponent();
- systype = a_systype;
- }
- private void ParticlesGridDevidePageShowConfig_Load(object sender, EventArgs e)
- {
- InitMyComponent();
- #region 国际化语言
- lan = new Language(this);
- languageTable = lan.GetNameTable(this.Name);
- #endregion
- }
- private void btn_xsys_Click(object sender, EventArgs e)
- {
- //打开编辑元素列表窗体
- OTSPeriodicTable.OTSPeriodicTableForm_Small opts = new OTSPeriodicTable.OTSPeriodicTableForm_Small();
- //获取需要显示的元素列表,并转换成元素周期表窗体可接受的格式,传入----------------------
- string str_xsys = tb_xsys.Text.Trim();
- List<string> list_str = new List<string>();
- string[] strs = str_xsys.Split(',');
- for (int i = 0; i < strs.Length; i++)
- {
- list_str.Add(strs[i]);
- }
- //清除元素周期表中所有的记录
- opts.m_List_Periodic.Clear();
- //将该分类下的元素添加到元素周期表窗体的List_periodic中
- for (int i = 0; i < strs.Length; i++)
- {
- string str_ysm = strs[i];
- Periodic ls_periodic = new Periodic();
- ls_periodic = CListPeriodic.GetPeriodicByEleName(str_ysm);
- opts.m_List_Periodic.Add(ls_periodic);
- }
- //----------------------------------------------------------------------------------------
- opts.StartPosition = FormStartPosition.CenterScreen;
- opts.ShowDialog();
- List<string> PeriodicFH = new List<string>();
- for (int j = 0; j < opts.m_List_Periodic.Count; j++)
- {
- PeriodicFH.Add(opts.m_List_Periodic[j].Symbol);
- }
- PeriodicFH.Sort(delegate (string a, string b) { return ReturnsAtomicNumberByElementName(a).CompareTo(ReturnsAtomicNumberByElementName(b)); });//排序 从小到大原子序数
- list_str = list_str.FindAll(delegate (string a) { return PeriodicFH.Contains(a); });
- PeriodicFH = PeriodicFH.FindAll(delegate (string a) { return !list_str.Contains(a); });
- //先清空元素
- str_xsys = "";
- //然后再将选择的元素,组合起来,返回显示到该窗体上
- for (int i = 0; i < list_str.Count; i++)
- {
- if (str_xsys == "")
- {
- str_xsys = list_str[i];
- }
- else
- {
- str_xsys = str_xsys + "," + list_str[i];
- }
- }
- for (int i = 0; i < PeriodicFH.Count; i++)
- {
- if (str_xsys == "")
- {
- str_xsys = PeriodicFH[i];
- }
- else
- {
- str_xsys = str_xsys + "," + PeriodicFH[i];
- }
- }
- //再对选择的元素进行显示
- tb_xsys.Text = str_xsys;
- }
- private void btn_ybcsbc_Click(object sender, EventArgs e)
- {
- //保存显示计算项
- string[] AttributeName_DefaultComputedColName = new string[] { "RegName", "strValue" };
- string[] Value_DefaultComputedColName = new string[] { "DefaultComputedColName", GetShowColumnsListStr() };
- bool ret = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.UpdateByAttribute(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, AttributeName_DefaultComputedColName, Value_DefaultComputedColName);
- //保存显示元素信息
- string[] AttributeName_ElementsColName = new string[] { "RegName", "strValue" };
- string[] Value_ElementsColName = new string[] { "ElementsColName", tb_xsys.Text.Trim() };
- ret = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.UpdateByAttribute(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, AttributeName_ElementsColName, Value_ElementsColName);
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- private void btn_ybcsqx_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- this.Close();
- }
- /// <summary>
- /// 获取从各checkbox中组合完成的字段
- /// </summary>
- private string GetShowColumnsListStr()
- {
- string str_ret = "";
- //帧图坐标
- if (cb_ParticleCoordinate.Checked == true)
- {
- str_ret = str_ret + "ParticleCoordinate" + ",";
- }
- //面积
- if (cb_Area.Checked == true)
- {
- str_ret = str_ret + "Area" + ",";
- }
- //等效圆直径
- if (cb_EquivalentCircleDiameter.Checked == true)
- {
- str_ret = str_ret + "EquivalentCircleDiameter" + ",";
- }
- //最长直径
- if (cb_MaxDiameter.Checked == true)
- {
- str_ret = str_ret + "MaxDiameter" + ",";
- }
- //最短直径
- if (cb_MinDiameter.Checked == true)
- {
- str_ret = str_ret + "MinDiameter" + ",";
- }
- //长短直径比
- if (cb_DiameterRatio.Checked == true)
- {
- str_ret = str_ret + "DiameterRatio" + ",";
- }
- //费雷特直径
- if (cb_FerretDiameter.Checked == true)
- {
- str_ret = str_ret + "FerretDiameter" + ",";
- }
- //正交直径
- if (cb_PERP.Checked == true)
- {
- str_ret = str_ret + "PERP" + ",";
- }
- //周长
- if (cb_PERI.Checked == true)
- {
- str_ret = str_ret + "PERI" + ",";
- }
- //内接圆直径
- if (cb_INSCR.Checked == true)
- {
- str_ret = str_ret + "INSCR" + ",";
- }
- //内接圆平均直径
- if (cb_MEAN.Checked == true)
- {
- str_ret = str_ret + "MEAN" + ",";
- }
- //展开长度
- if (cb_ELONG.Checked == true)
- {
- str_ret = str_ret + "ELONG" + ",";
- }
- //展开长度比
- if (cb_ASPECT_ELONG.Checked == true)
- {
- str_ret = str_ret + "ASPECT_ELONG" + ",";
- }
- //朝向角度
- if (cb_Orientation.Checked == true)
- {
- str_ret = str_ret + "Orientation" + ",";
- }
- //导电性
- if (cB_Electrical_conductivity.Checked == true)
- {
- str_ret = str_ret + "Electrical_conductivity" + ",";
- }
- //密度
- if (cB_Density.Checked == true)
- {
- str_ret = str_ret + "Density" + ",";
- }
- //硬度
- if (cB_Hardness.Checked == true)
- {
- str_ret = str_ret + "Hardness" + ",";
- }
- if (str_ret.Length > 0)
- {
- str_ret = str_ret.Substring(0, str_ret.Length - 1);
- }
- return str_ret;
- }
- int ReturnsAtomicNumberByElementName(string ElementName)
- {
- switch (ElementName)
- {
- case "H": return 1;
- case "He": return 2;
- case "Li": return 3;
- case "Be": return 4;
- case "B": return 5;
- case "C": return 6;
- case "N": return 7;
- case "O": return 8;
- case "F": return 9;
- case "Ne": return 10;
- case "Na": return 11;
- case "Mg": return 12;
- case "Al": return 13;
- case "Si": return 14;
- case "P": return 15;
- case "S": return 16;
- case "Cl": return 17;
- case "Ar": return 18;
- case "K": return 19;
- case "Ca": return 20;
- case "Sc": return 21;
- case "Ti": return 22;
- case "V": return 23;
- case "Cr": return 24;
- case "Mn": return 25;
- case "Fe": return 26;
- case "Co": return 27;
- case "Ni": return 28;
- case "Cu": return 29;
- case "Zn": return 30;
- case "Ga": return 31;
- case "Ge": return 32;
- case "As": return 33;
- case "Se": return 34;
- case "Br": return 35;
- case "Kr": return 36;
- case "Rb": return 37;
- case "Sr": return 38;
- case "Y": return 39;
- case "Zr": return 40;
- case "Nb": return 41;
- case "Mo": return 42;
- case "Tc": return 43;
- case "Ru": return 44;
- case "Rh": return 45;
- case "Pd": return 46;
- case "Ag": return 47;
- case "Cd": return 48;
- case "In": return 49;
- case "Sn": return 50;
- case "Sb": return 51;
- case "Te": return 52;
- case "I": return 53;
- case "Xe": return 54;
- case "Cs": return 55;
- case "Ba": return 56;
- case "La": return 57;
- case "Ce": return 58;
- case "Pr": return 59;
- case "Nd": return 60;
- case "Pm": return 61;
- case "Sm": return 62;
- case "Eu": return 63;
- case "Gd": return 64;
- case "Tb": return 65;
- case "Dy": return 66;
- case "Ho": return 67;
- case "Er": return 68;
- case "Tm": return 69;
- case "Yb": return 70;
- case "Lu": return 71;
- case "Hf": return 72;
- case "Ta": return 73;
- case "W": return 74;
- case "Re": return 75;
- case "Os": return 76;
- case "Ir": return 77;
- case "Pt": return 78;
- case "Au": return 79;
- case "Hq": return 80;
- case "TI": return 81;
- case "Pb": return 82;
- case "Bi": return 83;
- case "Po": return 84;
- case "At": return 85;
- case "Rn": return 86;
- case "Fr": return 87;
- case "Ra": return 88;
- case "Ac": return 89;
- case "Th": return 90;
- case "Pa": return 91;
- case "U": return 92;
- case "Np": return 93;
- case "Pu": return 94;
- case "Am": return 95;
- case "Cm": return 96;
- case "Bk": return 97;
- case "Cf": return 98;
- case "Es": return 99;
- case "Fm": return 100;
- case "Mc": return 101;
- case "No": return 102;
- case "Lr": return 103;
- case "Rf": return 104;
- case "Db": return 105;
- case "Sg": return 106;
- case "Bh": return 107;
- case "Hs": return 108;
- case "Mt": return 109;
- case "Ds": return 110;
- case "Rg": return 111;
- case "Unb": return 112;
- default: return 1000;
- }
- }
- public void InitMyComponent()
- {
- string str_DefaultComputedColName = "", str_ElementsColName = "";
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
- DataTable dt = ds.Tables["Member"];
- string str_scale = "";
- foreach (DataRow element in dt.Rows)
- {
- string RegName = element["RegName"].ToString();
- if (RegName == "DefaultComputedColName")
- {
- str_DefaultComputedColName = element["strValue"].ToString();
- }
- if (RegName == "ElementsColName")
- {
- str_ElementsColName = element["strValue"].ToString();
- }
- if (RegName == "Scale")
- {
- str_scale = element["strValue"].ToString();
- }
- }
- //显示元素
- tb_xsys.Text = str_ElementsColName;
- //设置计算显示列
- SetShowColumnsListStr(str_DefaultComputedColName);
- }
- private void SetShowColumnsListStr(string in_str)
- {
- cb_Area.Checked = false;
- cb_EquivalentCircleDiameter.Checked = false;
- cb_MaxDiameter.Checked = false;
- cb_MinDiameter.Checked = false;
- cb_DiameterRatio.Checked = false;
- cb_FerretDiameter.Checked = false;
- cb_PERP.Checked = false;
- cb_PERI.Checked = false;
- cb_INSCR.Checked = false;
- cb_MEAN.Checked = false;
- cb_ELONG.Checked = false;
- cb_ASPECT_ELONG.Checked = false;
- cb_Orientation.Checked = false;
- cb_ParticleCoordinate.Checked = false;
- cB_Hardness.Checked = false;
- cB_Density.Checked = false;
- cB_Electrical_conductivity.Checked = false;
- //面积
- if (in_str.IndexOf("Area") > -1)
- {
- cb_Area.Checked = true;
- }
- //等效圆直径
- if (in_str.IndexOf("EquivalentCircleDiameter") > -1)
- {
- cb_EquivalentCircleDiameter.Checked = true;
- }
- //最长直径
- if (in_str.IndexOf("MaxDiameter") > -1)
- {
- cb_MaxDiameter.Checked = true;
- }
- //最短直径
- if (in_str.IndexOf("MinDiameter") > -1)
- {
- cb_MinDiameter.Checked = true;
- }
- //长短直径比
- if (in_str.IndexOf("DiameterRatio") > -1)
- {
- cb_DiameterRatio.Checked = true;
- }
- //费雷特直径
- if (in_str.IndexOf("FerretDiameter") > -1)
- {
- cb_FerretDiameter.Checked = true;
- }
- //正交直径
- if (in_str.IndexOf("PERP") > -1)
- {
- cb_PERP.Checked = true;
- }
- //周长
- if (in_str.IndexOf("PERI") > -1)
- {
- cb_PERI.Checked = true;
- }
- //内接圆直径
- if (in_str.IndexOf("INSCR") > -1)
- {
- cb_INSCR.Checked = true;
- }
- //内接圆平均直径
- if (in_str.IndexOf("MEAN") > -1)
- {
- cb_MEAN.Checked = true;
- }
- //展开长度
- if (in_str.IndexOf("ELONG") > -1)
- {
- cb_ELONG.Checked = true;
- }
- //展开长度比
- if (in_str.IndexOf("ASPECT_ELONG") > -1)
- {
- cb_ASPECT_ELONG.Checked = true;
- }
- //朝向角度
- if (in_str.IndexOf("Orientation") > -1)
- {
- cb_Orientation.Checked = true;
- }
- //帧图坐标
- if (in_str.IndexOf("ParticleCoordinate") > -1)
- {
- cb_ParticleCoordinate.Checked = true;
- }
- if (systype == OTSCommon.Model.OTS_SysType_ID.CleannessA)
- {
- cB_Hardness.Enabled = true;
- cB_Density.Enabled = true;
- cB_Electrical_conductivity.Enabled = true;
- //硬度
- if (in_str.IndexOf("Hardness") > -1)
- {
- cB_Hardness.Checked = true;
- }
- //密度
- if (in_str.IndexOf("Density") > -1)
- {
- cB_Density.Checked = true;
- }
- //导电性
- if (in_str.IndexOf("Electrical_conductivity") > -1)
- {
- cB_Electrical_conductivity.Checked = true;
- }
- }
- else
- {
- cB_Hardness.Enabled = false;
- cB_Density.Enabled = false;
- cB_Electrical_conductivity.Enabled = false;
- }
- }
- private void label_help_MouseHover(object sender, EventArgs e)
- {
- // 创建the ToolTip
- ToolTip toolTip1 = new ToolTip();
- // 设置显示样式
- toolTip1.AutoPopDelay = 7000;//提示信息的可见时间
- toolTip1.InitialDelay = 500;//事件触发多久后出现提示
- toolTip1.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
- toolTip1.ShowAlways = true;//是否显示提示框
- string str = "";
- if (Language.ReadDefaultLanguage().ToString() == "ZH")
- {
- str = " 最长直径:颗粒最大卡规直径\n" +
- "最短直径: 颗粒最小卡规直径\n" +
- "长短直径比:颗粒长宽比\n" +
- "正交直径:与Dmax垂直的对应直径\n" +
- "内接圆平均直径:平均内接圆直径\n" +
- "内接圆直径:最大内接圆直径";
- }
- else
- {
- str = "Dmax:Maximum caliper diameter of particle\n" +
- "Dmin: Minimum caliper diameter of particle\n" +
- "Aspect:The aspect ratio of the particle\n" +
- "Dperp:Corresponding diameter perpendicular to Dmax\n" +
- "Dmean:Average diameter of the internal circle\n" +
- "Dinscr:Maximum diameter of the inner circle\n" +
- "Dequalcircle:Equivalent circular diameter";
- }
- // 设置伴随的对象.
- toolTip1.SetToolTip(this.label_help, str);
- }
- }
- }
|