ListOfSimilarParticles.cs 46 KB

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