ListOfSimilarParticles.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. using DevExpress.XtraTreeList.Filtering.Provider;
  2. using OTSCLRINTERFACE;
  3. using OTSCommon;
  4. using OTSCommon.DBOperate;
  5. using OTSCommon.DBOperate.Model;
  6. using OTSIncAReportApp._2_CommonFunction.CommonClass;
  7. using OTSIncAReportApp._3_ServiceCenter.DataOperation.DataAccess;
  8. using OTSIncAReportApp.DataOperation.DataAccess;
  9. using OTSIncAReportApp.OTSRstMgrFunction;
  10. using OTSIncAReportGraph.Class;
  11. using OTSIncAReportGrids.OTSIncAReportGridsFuncation;
  12. using OTSPeriodicTable;
  13. using System;
  14. using System.Collections;
  15. using System.Collections.Generic;
  16. using System.Data;
  17. using System.Data.SQLite;
  18. using System.Drawing;
  19. using System.Linq;
  20. using System.Reflection;
  21. using System.Threading;
  22. using System.Windows.Forms;
  23. using static OTSDataType.otsdataconst;
  24. using Color = System.Drawing.Color;
  25. namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
  26. {
  27. public partial class ListOfSimilarParticles : Form
  28. {
  29. OTSIncAReportGrids.ParticlesGridDevidePage _particlesGridDevidePage;
  30. CPosXrayClr SelXrayclr = new CPosXrayClr();
  31. DataTable particlesAll;
  32. DataTable particlesFilter;
  33. Hashtable table;
  34. List<string> _RenameInfo;
  35. private Thread m_mythread;
  36. //记录线程是否已经运行完成的状态
  37. private bool m_mythread_state = false;
  38. //底层操作类
  39. SEMAndEDSOperate m_OTSIncAReportGridsFun = null;
  40. frmReportApp m_ReportApp;
  41. public ParticleData Particledata;
  42. public UserSTDDbAccess userSTDDb;
  43. public FieldAndParticleImage fldImgAccess;
  44. public ResultFile _result = null;
  45. public ListOfSimilarParticles(OTSIncAReportGrids.ParticlesGridDevidePage particlesGridDevidePage, uint[] SelXray, List<string> RenameInfo,frmReportApp ReportApp)
  46. {
  47. InitializeComponent();
  48. _particlesGridDevidePage = particlesGridDevidePage;
  49. SelXrayclr.SetXrayData(SelXray);
  50. table = particlesGridDevidePage.table;
  51. _RenameInfo = RenameInfo;
  52. m_ReportApp = ReportApp;
  53. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  54. _result= particlesGridDevidePage.result;
  55. fldImgAccess = new FieldAndParticleImage(_result.FilePath);
  56. Particledata = new ParticleData(_result.FilePath);
  57. //设置窗体的双缓冲,以保证大数据时拖动不卡
  58. this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
  59. this.UpdateStyles();
  60. //利用反射设置DataGridView的双缓冲
  61. Type dgvType = this.dgV_SimilarParticles.GetType();
  62. PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
  63. pi.SetValue(this.dgV_SimilarParticles, true, null);
  64. this.control_XRayTable1 = new OTSIncAReportGraph.Controls.Control_XRayTable(null);
  65. this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  66. this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Bottom;
  67. this.control_XRayTable1.GBInfoStr = "";
  68. this.control_XRayTable1.GoodChineseName = "";
  69. this.control_XRayTable1.MaterialName = "";
  70. this.control_XRayTable1.Location = new System.Drawing.Point(0, 400);
  71. this.control_XRayTable1.Name = "control_XRayTable1";
  72. this.control_XRayTable1.ShowAnalysisXray = true;
  73. this.control_XRayTable1.ShowSearchXray = false;
  74. this.control_XRayTable1.Size = new System.Drawing.Size(1004, 200);
  75. this.control_XRayTable1.STDName = "";
  76. this.control_XRayTable1.Visible = false;
  77. this.control_XRayTable1.label_close.Visible = true;
  78. panel1.Controls.Add(this.control_XRayTable1);
  79. }
  80. private void btn_Search_Click(object sender, EventArgs e)
  81. {
  82. double val;
  83. if (!double.TryParse(tB_SimilarRatio.Text, out val))
  84. {
  85. MessageBox.Show("The value must range from 0 to 100!");
  86. return;
  87. }
  88. else
  89. {
  90. this.Cursor = Cursors.WaitCursor;
  91. particlesAll = ObtainSourceOfSimilarParticles();
  92. if (Scope1.SelectedIndex == 1)
  93. {
  94. for (int i = particlesAll.Rows.Count - 1; i >= 0; i--)
  95. {
  96. if (Convert.ToInt32(particlesAll.Rows[i]["TypeId"]) > 10)
  97. {
  98. particlesAll.Rows.RemoveAt(i);
  99. }
  100. }
  101. }
  102. DataTable elementchemistry = Particledata.GetElementChemistry();
  103. for (int i = 0; i < particlesAll.Rows.Count; i++)
  104. {
  105. string str = "XRayId = " + particlesAll.Rows[i]["particleId"].ToString() + " and fieldid = " + particlesAll.Rows[i]["fieldid"].ToString();
  106. DataRow[] drs = elementchemistry.Select(str);
  107. string ConcatenatedString = "";
  108. for (int j = 0; j < drs.Length; j++)
  109. {
  110. ConcatenatedString += drs[j]["name"] + "-" + drs[j]["Percentage"] + ';';
  111. }
  112. particlesAll.Rows[i]["Element"] = ConcatenatedString;
  113. }
  114. particlesAll.Columns.Add("SimilarRatio", typeof(double));
  115. DataTable XRayData = Particledata.GetXRayData();
  116. particlesAll.Columns.Add("XRayDataCount");
  117. particlesFilter = particlesAll.Clone();
  118. for (int i = 0; i < particlesAll.Rows.Count; i++)
  119. {
  120. if (int.Parse(particlesAll.Rows[i]["particleId"].ToString()) > -1)
  121. {
  122. string subParticleString = particlesAll.Rows[i]["SubParticles"].ToString();
  123. uint[] Analysis_xray = new uint[2000];
  124. particlesAll.Rows[i]["XRayDataCount"] = 0;
  125. if (subParticleString == "")
  126. {
  127. string str = " XrayIndex= " + particlesAll.Rows[i]["particleId"].ToString() + " and fieldid = " + particlesAll.Rows[i]["fieldid"].ToString();
  128. DataRow[] drs = XRayData.Select(str);
  129. uint xraycount = 0;
  130. if (drs != null)
  131. {
  132. if (drs.Length > 0)
  133. {
  134. for (int j = 0; j < 2000; j++)
  135. {
  136. Analysis_xray[j] = BitConverter.ToUInt32((byte[])drs[0][2], j * 4);
  137. }
  138. for (int j = 0; j < 2000; j++)
  139. {
  140. xraycount += Analysis_xray[j];
  141. }
  142. particlesAll.Rows[i]["XRayDataCount"] = xraycount;
  143. }
  144. }
  145. }
  146. else
  147. {
  148. DataRow dgvr = particlesAll.Rows[i];
  149. Particledata.GetXrayByParticleTagIDAndFieldID_ForMergeParticle(Convert.ToInt32(dgvr["particleId"]), Convert.ToInt32(dgvr["fieldid"]), out Analysis_xray);
  150. uint xraycount = 0;
  151. for (int j = 0; j < 2000; j++)
  152. {
  153. xraycount += Analysis_xray[j];
  154. }
  155. particlesAll.Rows[i]["XRayDataCount"] = xraycount;
  156. }
  157. CPosXrayClr Xrayclr = new CPosXrayClr();
  158. Xrayclr.SetXrayData(Analysis_xray);
  159. particlesAll.Rows[i]["SimilarRatio"] = GetCosValue(SelXrayclr, Xrayclr);
  160. if ((double)particlesAll.Rows[i]["SimilarRatio"] >= val / 100)
  161. {
  162. particlesFilter.ImportRow(particlesAll.Rows[i]);
  163. }
  164. }
  165. }
  166. particlesFilter.DefaultView.Sort = "SimilarRatio DESC";
  167. particlesFilter = particlesFilter.DefaultView.ToTable();
  168. BindDataGridView();
  169. SetDataGridViewStyle();
  170. cBx_All.Checked = false;
  171. cBx_All.Checked = true;
  172. label3.Text = "共搜索到" + (dgV_SimilarParticles.Rows.Count-1).ToString() + "个相似颗粒";
  173. this.Cursor = Cursors.Default;
  174. }
  175. }
  176. private void SetDataGridViewStyle()
  177. {
  178. //用户不能调整标题的高度
  179. dgV_SimilarParticles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  180. //用户不能调整 行高
  181. dgV_SimilarParticles.AllowUserToResizeRows = false;
  182. //点击选择整行
  183. dgV_SimilarParticles.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  184. //居中显示
  185. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  186. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  187. dgV_SimilarParticles.DefaultCellStyle = dataGridViewCellStyle1;
  188. dgV_SimilarParticles.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  189. //再次重覆禁用拖动表头高度,居然有效果了
  190. dgV_SimilarParticles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  191. //设置grid可以复制
  192. dgV_SimilarParticles.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  193. //设置每列的宽度
  194. dgV_SimilarParticles.Columns[0].Width = 30;//第一列序号的宽度设置一下吧,要不太丑
  195. dgV_SimilarParticles.Columns[1].Width = 100;
  196. for (int i = 4; i < dgV_SimilarParticles.Columns.Count; i++)
  197. {
  198. dgV_SimilarParticles.Columns[i].Width = 65;
  199. }
  200. //设置序号列不排序
  201. dgV_SimilarParticles.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  202. dgV_SimilarParticles.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
  203. //设置序号列不可以设置宽度
  204. dgV_SimilarParticles.Columns[0].Resizable = DataGridViewTriState.False;
  205. dgV_SimilarParticles.RowsDefaultCellStyle.BackColor = Color.Azure;
  206. if (dgV_SimilarParticles.Rows.Count > 0)
  207. {
  208. dgV_SimilarParticles.Rows[0].Frozen = true;
  209. }
  210. }
  211. private void BindDataGridView()
  212. {
  213. dgV_SimilarParticles.Visible = false;
  214. dgV_SimilarParticles.Rows.Clear();
  215. dgV_SimilarParticles.Columns.Clear();
  216. string str_DefaultComputedColName = "", str_ElementsColName = "";
  217. DataSet ds = OTSCommon.XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
  218. DataTable dt = ds.Tables["Member"];
  219. foreach (DataRow element in dt.Rows)
  220. {
  221. string RegName = element["RegName"].ToString();
  222. if (RegName == "DefaultComputedColName")
  223. {
  224. str_DefaultComputedColName = element["strValue"].ToString();
  225. }
  226. if (RegName == "ElementsColName")
  227. {
  228. str_ElementsColName = element["strValue"].ToString();
  229. }
  230. }
  231. string[] strs = str_DefaultComputedColName.Split(',');
  232. Dictionary<string, string> keyValues = new Dictionary<string, string>() { };
  233. keyValues.Add("SimilarRatio", "相似度");
  234. keyValues.Add("TypeName", table["str6"].ToString());
  235. keyValues.Add("ParticleImage", table["str5"].ToString());
  236. keyValues.Add("FieldId", "FieldId");
  237. keyValues.Add("ParticleId", "ParticleId");
  238. keyValues.Add("SEMPosX", "SEMPosX");
  239. keyValues.Add("SEMPosY", "SEMPosY");
  240. for (int i = 0; i < strs.Count(); i++)
  241. {
  242. if (strs[i] == "ParticleCoordinate")
  243. {
  244. keyValues.Add("AbPosX", "PosX");
  245. keyValues.Add("AbPosY", "PosY");
  246. }
  247. if (strs[i] == "Area")
  248. {
  249. keyValues.Add("Area", table["str21"].ToString());
  250. }
  251. if (strs[i] == "EquivalentCircleDiameter")
  252. {
  253. keyValues.Add("Equivalent", table["str22"].ToString());
  254. }
  255. if (strs[i] == "MaxDiameter")
  256. {
  257. keyValues.Add("DMAX", table["str23"].ToString());
  258. }
  259. if (strs[i] == "MinDiameter")
  260. {
  261. keyValues.Add("DMIN", table["str24"].ToString());
  262. }
  263. if (strs[i] == "DiameterRatio")
  264. {
  265. keyValues.Add("DiameterRatio", table["str25"].ToString());
  266. }
  267. if (strs[i] == "FerretDiameter")
  268. {
  269. keyValues.Add("DFERET", table["str26"].ToString());
  270. }
  271. if (strs[i] == "PERP")
  272. {
  273. keyValues.Add("DPERP", table["str27"].ToString());
  274. }
  275. if (strs[i] == "PERI")
  276. {
  277. keyValues.Add("PERIMETER", table["str28"].ToString());
  278. }
  279. if (strs[i] == "INSCR")
  280. {
  281. keyValues.Add("DINSCR", table["str29"].ToString());
  282. }
  283. if (strs[i] == "MEAN")
  284. {
  285. keyValues.Add("DMEAN", table["str30"].ToString());
  286. }
  287. if (strs[i] == "ELONG")
  288. {
  289. keyValues.Add("DELONG", table["str31"].ToString());
  290. }
  291. if (strs[i] == "ASPECT_ELONG")
  292. {
  293. keyValues.Add("ASPECT_ELONG", table["str32"].ToString());
  294. }
  295. if (strs[i] == "Orientation")
  296. {
  297. keyValues.Add("ORIENTATION", table["str33"].ToString());
  298. }
  299. if (strs[i] == "XRayDataCount")
  300. {
  301. keyValues.Add("XRayDataCount", "XRay计数");
  302. }
  303. }
  304. keyValues.Add("Element", "Element");
  305. Dictionary<string, string>.Enumerator en = keyValues.GetEnumerator();
  306. for (int irow = 0; irow < keyValues.Count; irow++)
  307. {
  308. if (en.MoveNext())
  309. {
  310. if (en.Current.Key == "ParticleImage")
  311. {
  312. DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
  313. iconColumn.Name = en.Current.Key;
  314. iconColumn.HeaderText = en.Current.Value;
  315. dgV_SimilarParticles.Columns.Add(iconColumn);
  316. }
  317. else if (en.Current.Key == "Element")
  318. {
  319. }
  320. else
  321. {
  322. dgV_SimilarParticles.Columns.Add(en.Current.Key, en.Current.Value);
  323. if (en.Current.Key == "Area" || en.Current.Key == "EquivalentCircleDiameter" || en.Current.Key == "MaxDiameter" || en.Current.Key == "MinDiameter" || en.Current.Key == "DiameterRatio" || en.Current.Key == "FerretDiameter" || en.Current.Key == "PERP" || en.Current.Key == "PERI" || en.Current.Key == "INSCR" || en.Current.Key == "MEAN" || en.Current.Key == "ELONG" || en.Current.Key == "ASPECT_ELONG" || en.Current.Key == "Orientation")
  324. {
  325. int id = dgV_SimilarParticles.Columns.Count;
  326. dgV_SimilarParticles.Columns[id - 1].Tag = "NumericType";
  327. }
  328. }
  329. }
  330. }
  331. if (particlesAll == null)
  332. {
  333. return;
  334. }
  335. string particleM = "";
  336. List<string> ElementTypeSort = new List<string>(str_ElementsColName.Split(',').ToList());//去重
  337. for (int i = 0; i < ElementTypeSort.Count; i++)
  338. {
  339. if (ElementTypeSort[0] == "")
  340. {
  341. ElementTypeSort.RemoveAt(0);
  342. break;
  343. }
  344. dgV_SimilarParticles.Columns.Add(ElementTypeSort[i], ElementTypeSort[i]);
  345. int id = dgV_SimilarParticles.Columns.Count;
  346. dgV_SimilarParticles.Columns[id - 1].Tag = "NumericType";
  347. }
  348. string filePath = _particlesGridDevidePage.result.FilePath + "\\FIELD_FILES\\";
  349. KeyValuePair<string, Bitmap> FieldImage = new KeyValuePair<string, Bitmap>();
  350. for (int i = 0; i < particlesFilter.Rows.Count; i++)
  351. {
  352. Dictionary<string, string>.Enumerator enl = keyValues.GetEnumerator();
  353. Dictionary<string, Bitmap> fieldpics = new Dictionary<string, Bitmap>();
  354. int add_rowindex = dgV_SimilarParticles.Rows.Add();
  355. for (int k = 0; k < keyValues.Count; k++)
  356. {
  357. if (enl.MoveNext())
  358. {
  359. if (enl.Current.Key == "ParticleImage")
  360. {
  361. string subParticleString = particlesFilter.Rows[i]["SubParticles"].ToString();
  362. dgV_SimilarParticles.Rows[add_rowindex].Height = 150;
  363. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
  364. Bitmap bmap = null;
  365. if (subParticleString != null && subParticleString != "" && subParticleString != "IsSubParticle")
  366. {
  367. double pix = _result.GetPixelSize();
  368. int width = _result.GetImageWidth();
  369. int height = _result.GetImageHeight();
  370. string substring = "," + subParticleString.Replace(':', '-') + ",";
  371. DataTable dataTable = Particledata.GetParticleAllForBig(substring);//组成拼接颗粒的子颗粒
  372. bmap = fldImgAccess.GetBitmapForMergedParticle(subParticleString, pix, height, width, dataTable);
  373. if (bmap != null)
  374. {
  375. string[] str = subParticleString.Split(',');
  376. bmap.Tag = new List<string>() { str[0].Split(':')[0], str[0].Split(':')[1] };
  377. }
  378. }
  379. else if (subParticleString != "IsSubParticle")
  380. {
  381. if (!fieldpics.Keys.Contains(particlesFilter.Rows[i]["fieldid"].ToString()))
  382. {
  383. string imagePath = "Field" + particlesFilter.Rows[i]["fieldid"].ToString() + ".bmp";
  384. fieldpics.Add(particlesFilter.Rows[i]["fieldid"].ToString(), fldImgAccess.ReadImageFile(imagePath));
  385. }
  386. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particlesFilter.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particlesFilter.Rows[i]["RectTop"]), Width = Convert.ToInt32(particlesFilter.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particlesFilter.Rows[i]["RectHeight"]) };
  387. bmap = fldImgAccess.CapturePic(fieldpics[particlesFilter.Rows[i]["fieldid"].ToString()], rectangle);
  388. bmap.Tag = new List<string>() { particlesFilter.Rows[i]["FieldId"].ToString(), particlesFilter.Rows[i]["ParticleId"].ToString() };
  389. dgV_SimilarParticles.Rows[add_rowindex].Height = bmap.Height + 20;
  390. }
  391. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = bmap;
  392. }
  393. if (enl.Current.Key == "DiameterRatio")
  394. {
  395. double d = Convert.ToDouble(particlesFilter.Rows[i]["DMAX"]) / Convert.ToDouble(particlesFilter.Rows[i]["DMIN"]);
  396. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(d, 2);
  397. }
  398. if (en.Current.Key == "Element")
  399. {
  400. }
  401. if (enl.Current.Key == "ASPECT_ELONG")
  402. {
  403. double d = Convert.ToDouble(particlesFilter.Rows[i]["DELONG"]) / Convert.ToDouble(particlesFilter.Rows[i]["DMEAN"]);
  404. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(d, 2);
  405. }
  406. if (particlesFilter.Columns.Contains(enl.Current.Key))
  407. {
  408. double num = 0;
  409. if (double.TryParse(particlesFilter.Rows[i][enl.Current.Key].ToString(), out num))
  410. {
  411. if (enl.Current.Key == "SimilarRatio")
  412. {
  413. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 5);
  414. }
  415. else
  416. {
  417. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 2);
  418. }
  419. }
  420. else if (enl.Current.Key == "Element")
  421. {
  422. List<string> elementtemp = new List<string>(ElementTypeSort);
  423. string[] strcbo = particlesFilter.Rows[i][enl.Current.Key].ToString().Split(';');
  424. for (int j = 0; j < strcbo.Length; j++)
  425. {
  426. if (ElementTypeSort.Count == 0)
  427. {
  428. break;
  429. }
  430. string[] str = strcbo[j].Split('-');
  431. if (ElementTypeSort.Contains(str[0]))
  432. { dgV_SimilarParticles.Rows[add_rowindex].Cells[str[0].ToString()].Value = Math.Round(double.Parse(str[1]), 2).ToString(); }
  433. elementtemp.Remove(str[0].ToString());
  434. }
  435. foreach (var ele in elementtemp)
  436. {
  437. dgV_SimilarParticles.Rows[add_rowindex].Cells[ele].Value = "0";
  438. }
  439. }
  440. else
  441. {
  442. double val = 0;
  443. if (double.TryParse(Convert.ToString(particlesFilter.Rows[i][enl.Current.Key]), out val))
  444. {
  445. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = val;
  446. }
  447. else
  448. {
  449. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = particlesFilter.Rows[i][enl.Current.Key];
  450. }
  451. }
  452. }
  453. if (enl.Current.Key == "TypeName")
  454. {
  455. if (particlesFilter.Rows[i]["TypeId"].ToString() == "9")
  456. {
  457. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = "Not Identified";
  458. }
  459. }
  460. if (enl.Current.Key == "Equivalent")
  461. {
  462. double dSize = Convert.ToDouble(particlesFilter.Rows[i]["Area"]);
  463. double Diameter = Math.Sqrt(dSize / Math.PI) * 2;
  464. dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(Diameter, 2);
  465. }
  466. if (enl.Current.Key == "AbPosX")
  467. {
  468. Point point = OTSIncAReportGrids.ParticlesGridDevidePage.CalculateParticleCenterPosition(_particlesGridDevidePage.result, new Point(Convert.ToInt32(particlesFilter.Rows[i]["SEMPosX"]), Convert.ToInt32(particlesFilter.Rows[i]["SEMPosY"])), new Point(Convert.ToInt32(particlesFilter.Rows[i]["PosX"]), Convert.ToInt32(particlesFilter.Rows[i]["PosY"])));
  469. dgV_SimilarParticles.Rows[add_rowindex].Cells["AbPosX"].Value = point.X;
  470. dgV_SimilarParticles.Rows[add_rowindex].Cells["AbPosY"].Value = point.Y;
  471. }
  472. }
  473. }
  474. }
  475. DataGridViewCheckBoxColumn checkBoxColumn = new DataGridViewCheckBoxColumn();
  476. checkBoxColumn.HeaderText = "选择";
  477. checkBoxColumn.Name = "IsSelected";
  478. checkBoxColumn.TrueValue = true;
  479. checkBoxColumn.FalseValue = false;
  480. checkBoxColumn.Width = 30;
  481. checkBoxColumn.ReadOnly = false;
  482. dgV_SimilarParticles.Columns.Insert(0, checkBoxColumn);
  483. if (_RenameInfo != null)
  484. {
  485. dgV_SimilarParticles.Rows[0].Cells[2].Value = _RenameInfo[1];
  486. }
  487. dgV_SimilarParticles.Visible = true;
  488. }
  489. private double GetCosValue(CPosXrayClr posXray, CPosXrayClr posXray1)
  490. {
  491. if (posXray == null) return 0;
  492. if (posXray1 == null) return 0;
  493. if (posXray.GetChannelsNum() != posXray1.GetChannelsNum())
  494. {
  495. return 0;
  496. }
  497. var pXrayData = posXray.GetXrayData();
  498. var pXrayData1 = posXray1.GetXrayData();
  499. // 公式: (x1y1+x2y2+x3y3+...x2000y2000) / (sqrt(x1^2 + x2^2 + ...x2000^2) * sqrt(y1^2 + y2^2 + ...y2000^2))
  500. double dotProduct = 0;
  501. double d1 = 0;
  502. double d2 = 0;
  503. for (int i = 0; i < posXray.GetChannelsNum(); i++)
  504. {
  505. double r1 = pXrayData[i];
  506. double r2 = pXrayData1[i];
  507. r1 *= r2;
  508. dotProduct = dotProduct + r1;
  509. }
  510. d1 = posXray.GetXrayDataVectorNorm();
  511. d2 = posXray1.GetXrayDataVectorNorm();
  512. return (0 == d1 || 0 == d2) ? 0 : dotProduct / (d1 * d2);
  513. }
  514. private void ListOfSimilarParticles_Load(object sender, EventArgs e)
  515. {
  516. Scope1.SelectedIndex = 0;
  517. btn_Search_Click(null, null);
  518. }
  519. private void btn_OK_Click(object sender, EventArgs e)
  520. {
  521. if (_RenameInfo == null)
  522. {
  523. string CategoryName = "";
  524. //循环选中颗粒
  525. DataGridViewRow dgvr = dgV_SimilarParticles.Rows[0];
  526. CategoryName = dgvr.Cells[2].Value.ToString();
  527. string TypeId = "";
  528. string TypeName = "";
  529. string TypeColor = "";
  530. string GroupName = "";
  531. string GroupID = "";
  532. string GroupColor = "";
  533. string[] resulta = _particlesGridDevidePage.result.GetSTDName().Split('.');
  534. DataTable data = ReadClassification(_particlesGridDevidePage.result.FilePath, resulta[0]);
  535. ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(data, CategoryName);
  536. DialogResult result = modifyCategoryForm.ShowDialog();
  537. if (modifyCategoryForm.DoYouWantToModifyIt)
  538. {
  539. TypeId = modifyCategoryForm.OutTypeAndName[0];
  540. TypeName = modifyCategoryForm.OutTypeAndName[1];
  541. TypeColor = modifyCategoryForm.OutTypeAndName[2];
  542. GroupName = modifyCategoryForm.OutTypeAndName[3];
  543. GroupID = modifyCategoryForm.OutTypeAndName[4];
  544. GroupColor = modifyCategoryForm.OutTypeAndName[5];
  545. _RenameInfo = new List<string>();
  546. _RenameInfo.Add(TypeId);
  547. _RenameInfo.Add(TypeName);
  548. _RenameInfo.Add(TypeColor);
  549. _RenameInfo.Add(GroupName);
  550. _RenameInfo.Add(GroupID);
  551. _RenameInfo.Add(GroupColor);
  552. }
  553. else
  554. {
  555. return;
  556. }
  557. }
  558. List<KeyValuePair<string, SQLiteParameter[]>> cmdlist = new List<KeyValuePair<string, SQLiteParameter[]>>();
  559. foreach (DataGridViewRow row in dgV_SimilarParticles.Rows)
  560. {
  561. if (row.Cells["IsSelected"].Value != null && (bool)row.Cells["IsSelected"].Value)
  562. {
  563. row.Cells[1].Value = _RenameInfo[0];
  564. Bitmap ls_bp = (Bitmap)row.Cells[3].Value;
  565. List<string> list_str = (List<string>)ls_bp.Tag;
  566. int i_ls_fieldid = Convert.ToInt32(list_str[0]);
  567. int i_ls_particleid = Convert.ToInt32(list_str[1]);
  568. List<int> ints = new List<int>();
  569. ints.Add(i_ls_fieldid);
  570. ints.Add(i_ls_particleid);
  571. var cmd = Particledata.GetUpdataAIncACmd(ints, _RenameInfo);
  572. cmdlist.Add(cmd);
  573. }
  574. }
  575. Particledata.ExecuteNonQueryBatch(cmdlist);
  576. this.DialogResult = DialogResult.OK;
  577. this.Close();
  578. }
  579. /// <summary>
  580. /// 读取标准库的ClassifySTD表
  581. /// </summary>
  582. /// <param name="a_address"></param>
  583. /// <returns></returns>
  584. private DataTable ReadClassification(string a_address, string STDName)
  585. {
  586. DataTable dt_STDGroups = new DataTable();
  587. DataTable dt_ClassifySTD = new DataTable();
  588. DataTable dt_IncAData = new DataTable();
  589. var systype = m_ReportApp.m_RptConfigFile.Systype;
  590. if (systype == OTS_SysType_ID.IncA)
  591. {
  592. dt_ClassifySTD.Columns.Add("STDId");
  593. dt_ClassifySTD.Columns.Add("StrName");
  594. dt_ClassifySTD.Columns.Add("Color");
  595. dt_ClassifySTD.Columns.Add("KeyElementList");
  596. dt_ClassifySTD.Columns.Add("SubElementList");
  597. dt_ClassifySTD.Columns.Add("UsingImgPropertyList");
  598. dt_ClassifySTD.Columns.Add("UsingOtherPropertyList");
  599. dt_ClassifySTD.Columns.Add("Expression");
  600. dt_ClassifySTD.Columns.Add("Hardness");
  601. dt_ClassifySTD.Columns.Add("Density");
  602. dt_ClassifySTD.Columns.Add("Electrical_conductivity");
  603. dt_ClassifySTD.Columns.Add("BSE");
  604. dt_ClassifySTD.Columns.Add("Formula");
  605. dt_ClassifySTD.Columns.Add("Element");
  606. dt_ClassifySTD.Columns.Add("IfElementAnalysis");
  607. dt_ClassifySTD.Columns.Add("ListNum");
  608. dt_ClassifySTD.Columns.Add("GroupId");
  609. dt_ClassifySTD.Columns.Add("GroupName");
  610. dt_ClassifySTD.Columns.Add("GroupColor");
  611. DataTable da = Particledata.GetParticleListForParticlSizeID("area", "");
  612. for (int i = 0; i < da.Rows.Count; i++)
  613. {
  614. if (Convert.ToInt64(da.Rows[i]["TypeId"]) > 9)
  615. {
  616. DataRow newRow = dt_ClassifySTD.NewRow();
  617. newRow["STDId"] = da.Rows[i]["TypeId"];
  618. newRow["StrName"] = da.Rows[i]["TypeName"];
  619. newRow["Color"] = da.Rows[i]["TypeColor"];
  620. newRow["GroupId"] = da.Rows[i]["GroupId"];
  621. newRow["GroupName"] = da.Rows[i]["GroupName"];
  622. newRow["GroupColor"] = da.Rows[i]["GroupColor"];
  623. dt_ClassifySTD.Rows.Add(newRow);
  624. }
  625. }
  626. }
  627. else
  628. {
  629. SqLiteHelper sh_STDGroups = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
  630. dt_STDGroups = sh_STDGroups.ExecuteQuery("select * from STDGroups");
  631. SqLiteHelper sh_ClassifySTD = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
  632. dt_ClassifySTD = sh_ClassifySTD.ExecuteQuery("select * from ClassifySTD");
  633. dt_ClassifySTD.Columns.Add("GroupName");
  634. dt_ClassifySTD.Columns.Add("GroupColor");
  635. for (int i = 0; i < dt_ClassifySTD.Rows.Count; i++)
  636. {
  637. for (int a = 0; a < dt_STDGroups.Rows.Count; a++)
  638. {
  639. if (dt_ClassifySTD.Rows[i]["GroupId"].ToString() == dt_STDGroups.Rows[a]["id"].ToString())
  640. {
  641. dt_ClassifySTD.Rows[i]["GroupName"] = dt_STDGroups.Rows[a]["name"].ToString();
  642. dt_ClassifySTD.Rows[i]["GroupColor"] = dt_STDGroups.Rows[a]["color"].ToString();
  643. continue;
  644. }
  645. }
  646. }
  647. SqLiteHelper sh_Inclusion = new SqLiteHelper("data source='" + a_address + "\\FIELD_FILES\\Inclusion.db" + "'");
  648. dt_IncAData = sh_Inclusion.ExecuteQuery("select * from IncAData");
  649. for (int i = 0; i < dt_IncAData.Rows.Count; i++)
  650. {
  651. if (Convert.ToInt64(dt_IncAData.Rows[i]["TypeId"]) > 50000)
  652. {
  653. DataRow newRow = dt_ClassifySTD.NewRow();
  654. newRow["STDId"] = dt_IncAData.Rows[i]["TypeId"];
  655. newRow["StrName"] = dt_IncAData.Rows[i]["TypeName"];
  656. newRow["Color"] = dt_IncAData.Rows[i]["TypeColor"];
  657. newRow["GroupId"] = dt_IncAData.Rows[i]["GroupId"];
  658. newRow["GroupName"] = dt_IncAData.Rows[i]["GroupName"];
  659. newRow["GroupColor"] = dt_IncAData.Rows[i]["GroupColor"];
  660. dt_ClassifySTD.Rows.Add(newRow);
  661. }
  662. }
  663. }
  664. return dt_ClassifySTD;
  665. }
  666. private void cBx_All_CheckedChanged(object sender, EventArgs e)
  667. {
  668. CheckBox selectAllCheckBox = (CheckBox)sender;
  669. bool isNull = true;
  670. foreach (DataGridViewRow row in dgV_SimilarParticles.Rows)
  671. {
  672. DataGridViewCheckBoxCell checkBox = row.Cells["IsSelected"] as DataGridViewCheckBoxCell;
  673. checkBox.Value = selectAllCheckBox.Checked;
  674. isNull = false;
  675. }
  676. if (!isNull)
  677. dgV_SimilarParticles.Rows[0].Cells[0].Value = true;
  678. }
  679. DataTable ObtainSourceOfSimilarParticles()
  680. {
  681. return Particledata.GetInfoForPartucleDevidePage_allParticles("");
  682. }
  683. private void btn_Cannnel_Click(object sender, EventArgs e)
  684. {
  685. this.DialogResult = DialogResult.Cancel;
  686. this.Close();
  687. }
  688. private void dgV_SimilarParticles_MouseUp(object sender, MouseEventArgs e)
  689. {
  690. var SelectRows = dgV_SimilarParticles.SelectedRows;
  691. if (SelectRows.Count != 0)
  692. {
  693. if (SelectRows.Count == 1)
  694. {
  695. DataGridViewRow dgvr = SelectRows[0];
  696. Bitmap ls_bp = (Bitmap)dgvr.Cells[3].Value;
  697. uint[] Analysis_xray = new uint[2000];
  698. int i_xray_id = 0;
  699. List<Element> list_celementchemistryclr = new List<Element>();
  700. Particle particle = new Particle();
  701. string str = " particleId= " + dgvr.Cells["particleId"].Value.ToString() + " and fieldid = " + dgvr.Cells["fieldid"].Value.ToString();
  702. DataRow[] drs = particlesFilter.Select(str);
  703. DataRow row = drs[0];
  704. string subParticleString = row["SubParticles"].ToString();
  705. if (subParticleString != "" && subParticleString != null)
  706. {
  707. particle = Particledata.GetXrayByParticleTagIDAndFieldID_ForMergeParticle(Convert.ToInt32(dgvr.Cells["particleId"].Value), Convert.ToInt32(dgvr.Cells["fieldid"].Value), out Analysis_xray);
  708. list_celementchemistryclr = particle.ElementList;
  709. }
  710. else
  711. {
  712. particle = _particlesGridDevidePage.ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(Convert.ToInt32(dgvr.Cells["particleId"].Value), Convert.ToInt32(dgvr.Cells["fieldid"].Value), out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
  713. }
  714. List<OTSIncAReportGraph.Controls.ShowElementInfo> list_showelementinfo = Particledata.GetShowElementInfos(list_celementchemistryclr);
  715. string str_IncAName = "";
  716. str_IncAName = Convert.ToString(dgvr.Cells[2].Value);
  717. if (particle == null)
  718. {
  719. return;
  720. }
  721. control_XRayTable1.SetParticleInfo("Area:" + Math.Round(particle.Area, 2) + " " + "DMAX:" + Math.Round(particle.DMAX, 2) + " " + "DELONG:" + Math.Round(particle.DELONG, 2) + " " + "DFERET:" + Math.Round(particle.DFERET, 2) + " " + "DINSCR:" + Math.Round(particle.DINSCR, 2) + "\n" + "DMEAN:" + Math.Round(particle.DMEAN, 2) + " " + "DMIN:" + Math.Round(particle.DMIN, 2) + " " + "DPERP:" + Math.Round(particle.DPERP, 2) + " " + "ORIENTATION:" + Math.Round(particle.ORIENTATION, 2) + " " + "PERIMETER:" + Math.Round(particle.PERIMETER, 2));
  722. control_XRayTable1.Visible = true;
  723. control_XRayTable1.SetXRayShowLineValue(Analysis_xray, list_showelementinfo);
  724. control_XRayTable1.GBInfoStr = "";
  725. control_XRayTable1.MaterialName = str_IncAName;
  726. control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
  727. DataTable dataTable = new DataTable();
  728. double pix = _result.GetPixelSize();
  729. int width = _result.GetImageWidth();
  730. int height = _result.GetImageHeight();
  731. Dictionary<string, List<Segment>> segsData = new Dictionary<string, List<Segment>>();
  732. if (subParticleString == "" || subParticleString == null)
  733. {
  734. int fldid = Convert.ToInt32(dgvr.Cells["fieldid"].Value);
  735. int partid = Convert.ToInt32(dgvr.Cells["particleId"].Value);
  736. var listseg = Particledata.GetSegmentData(fldid, partid);
  737. string key = fldid.ToString() + "_" + partid.ToString();
  738. segsData.Add(key, listseg);
  739. dataTable = particlesFilter.Clone();
  740. dataTable.ImportRow(row);
  741. }
  742. else
  743. {
  744. string vs = "," + subParticleString.Replace(':', '-') + ",";
  745. dataTable = Particledata.GetParticleAllForBig(vs);//组成拼接颗粒的子颗粒
  746. foreach (DataRow dow in dataTable.Rows)
  747. {
  748. int fldid = Convert.ToInt32(dow["fieldid"]);
  749. int partid = Convert.ToInt32(dow["particleId"]);
  750. var listseg = Particledata.GetSegmentData(fldid, partid);
  751. string key = dow["fieldid"].ToString() + "_" + dow["particleid"].ToString();
  752. segsData.Add(key, listseg);
  753. }
  754. }
  755. Bitmap bmap = fldImgAccess.GetBitmapForParticleAll(subParticleString, dataTable, pix, height, width);
  756. Bitmap bmap1 = fldImgAccess.GetBitmapForParticleAllWithBlackAndWhite(subParticleString, dataTable, segsData, pix, height, width);
  757. control_XRayTable1.SetBitmapOfPictureBox(bmap1, bmap);
  758. Invalidate();
  759. }
  760. }
  761. }
  762. private void movetoparticleToolStripMenuItem_Click(object sender, EventArgs e)
  763. {
  764. //先获取鼠标所选择的行里的颗粒的FieldID和ParticleID
  765. string i_ls_fieldid = "";
  766. string i_ls_particleid = "";
  767. int cou = dgV_SimilarParticles.SelectedRows.Count;
  768. if (cou > 0)
  769. {
  770. DataGridViewRow dgvr = dgV_SimilarParticles.SelectedRows[cou - 1];
  771. Bitmap ls_bp = (Bitmap)dgvr.Cells[3].Value;
  772. List<string> list_str = (List<string>)ls_bp.Tag;
  773. if (list_str != null)
  774. {
  775. i_ls_fieldid = list_str[0];
  776. i_ls_particleid = list_str[1];
  777. }
  778. }
  779. DataOperation.DataAccess.ParticleData particleData = new DataOperation.DataAccess.ParticleData(_particlesGridDevidePage.result.FilePath);
  780. Particle particle = particleData.GetParticleByFidAndPid(i_ls_fieldid, i_ls_particleid);
  781. //取得Field的Position,然后执行线程移动SEM到当前Field的位置
  782. if (m_mythread == null)
  783. {
  784. return;
  785. }
  786. if (m_mythread.ThreadState == ThreadState.Running || m_mythread.ThreadState == ThreadState.WaitSleepJoin)
  787. {
  788. return;
  789. }
  790. if (m_mythread.ThreadState == ThreadState.Stopped)
  791. {
  792. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  793. }
  794. Point point = OTSIncAReportGrids.ParticlesGridDevidePage.CalculateParticleCenterPosition(_particlesGridDevidePage.result, new Point(particle.SEMPosX, particle.SEMPosY), new Point(particle.PosX, particle.PosY));
  795. //改为线程调用,先判断线程状态
  796. m_mythread.Start(point);
  797. }
  798. #region 连接电镜相关
  799. /// <summary>
  800. /// 移动SEM到指定位置线程函数
  801. /// </summary>
  802. private void Thread_GO(object in_obj)
  803. {
  804. if (m_mythread_state == false)
  805. {
  806. m_mythread_state = true;
  807. Point sem_point = (Point)in_obj;
  808. //第一步,连接电镜
  809. m_OTSIncAReportGridsFun.Connection_ForParticlesGrid();
  810. Thread.Sleep(500);
  811. //第二步,移动到指定位置,先读取再设置
  812. if (m_OTSIncAReportGridsFun.m_SEMConnectionState == true)
  813. {
  814. m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
  815. }
  816. Thread.Sleep(1500);
  817. m_mythread_state = false;
  818. }
  819. }
  820. #endregion
  821. private void dgV_SimilarParticles_KeyUp(object sender, KeyEventArgs e)
  822. {
  823. if (e.KeyData == Keys.Down)
  824. {
  825. dgV_SimilarParticles_MouseUp(null, null);
  826. }
  827. if (e.KeyData == Keys.Up)
  828. {
  829. dgV_SimilarParticles_MouseUp(null, null);
  830. }
  831. if (e.KeyData == Keys.Space)
  832. {
  833. dgV_SimilarParticles_CellMouseDoubleClick(null,null);
  834. }
  835. }
  836. private void tB_SimilarRatio_KeyUp(object sender, KeyEventArgs e)
  837. {
  838. if (e.KeyData == Keys.Enter)
  839. {
  840. btn_Search_Click(null, null);
  841. }
  842. }
  843. private void dgV_SimilarParticles_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  844. {
  845. var SelectRows = dgV_SimilarParticles.SelectedRows;
  846. if (SelectRows.Count != 0)
  847. {
  848. if (SelectRows.Count == 1)
  849. {
  850. DataGridViewRow dgvr = SelectRows[0];
  851. if ((bool)dgvr.Cells[0].EditedFormattedValue == true)
  852. {
  853. dgvr.Cells[0].Value = false;
  854. }
  855. else
  856. {
  857. dgvr.Cells[0].Value = true;
  858. }
  859. dgV_SimilarParticles.Rows[0].Cells[0].Value = true;
  860. }
  861. }
  862. }
  863. public ListOfSimilarParticles(OTSIncAReportGrids.ParticlesGridDevidePage particlesGridDevidePage, uint[] SelXray, frmReportApp ReportApp)
  864. {
  865. InitializeComponent();
  866. _particlesGridDevidePage = particlesGridDevidePage;
  867. SelXrayclr.SetXrayData(SelXray);
  868. table = particlesGridDevidePage.table;
  869. m_ReportApp = ReportApp;
  870. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  871. _result = particlesGridDevidePage.result;
  872. fldImgAccess = new FieldAndParticleImage(_result.FilePath);
  873. Particledata = new ParticleData(_result.FilePath);
  874. //设置窗体的双缓冲,以保证大数据时拖动不卡
  875. this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
  876. this.UpdateStyles();
  877. //利用反射设置DataGridView的双缓冲
  878. Type dgvType = this.dgV_SimilarParticles.GetType();
  879. PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
  880. pi.SetValue(this.dgV_SimilarParticles, true, null);
  881. this.control_XRayTable1 = new OTSIncAReportGraph.Controls.Control_XRayTable(null);
  882. this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  883. this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Bottom;
  884. this.control_XRayTable1.GBInfoStr = "";
  885. this.control_XRayTable1.GoodChineseName = "";
  886. this.control_XRayTable1.MaterialName = "";
  887. this.control_XRayTable1.Location = new System.Drawing.Point(0, 400);
  888. this.control_XRayTable1.Name = "control_XRayTable1";
  889. this.control_XRayTable1.ShowAnalysisXray = true;
  890. this.control_XRayTable1.ShowSearchXray = false;
  891. this.control_XRayTable1.Size = new System.Drawing.Size(1004, 200);
  892. this.control_XRayTable1.STDName = "";
  893. this.control_XRayTable1.Visible = false;
  894. this.control_XRayTable1.label_close.Visible = true;
  895. panel1.Controls.Add(this.control_XRayTable1);
  896. }
  897. private void 从此颗粒之下取消选择ToolStripMenuItem_Click(object sender, EventArgs e)
  898. {
  899. var SelectRows = dgV_SimilarParticles.SelectedRows;
  900. if (SelectRows.Count != 0)
  901. {
  902. DataGridViewRow dgvr = SelectRows[0];
  903. for (int i = dgvr.Index + 1; i < dgV_SimilarParticles.Rows.Count; i++)
  904. {
  905. dgV_SimilarParticles.Rows[i].Cells[0].Value=false;
  906. }
  907. if(dgvr.Index + 1!= dgV_SimilarParticles.Rows.Count)
  908. {
  909. this.cBx_All.CheckedChanged -= new System.EventHandler(this.cBx_All_CheckedChanged);
  910. cBx_All.Checked=false;
  911. this.cBx_All.CheckedChanged += new System.EventHandler(this.cBx_All_CheckedChanged);
  912. }
  913. }
  914. }
  915. }
  916. }