MethodAreaDialog.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. using OpenCvSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Drawing.Drawing2D;
  6. using System.Windows.Forms;
  7. using PaintDotNet.Base.DedicatedAnalysis.GrainSize;
  8. namespace PaintDotNet.DedicatedAnalysis.GrainSizeStandard.GBT6394
  9. {
  10. internal class MethodAreaDialog : GrainSizeStandardDialog
  11. {
  12. #region 组件
  13. private GroupBox groupBox_ShowParamSetting;
  14. private Button button_ShowRefresh;
  15. private CheckBox checkBox_ShowGrainColor;
  16. private CheckBox checkBox_ShowGrainNumber;
  17. private CheckBox checkBox_ShowGrid;
  18. private CheckBox checkBox_ShowGrainBoundry;
  19. //private DataGridViewTextBoxColumn ColumnTotal1;
  20. private DataGridViewTextBoxColumn ColumnTotal2;
  21. private DataGridViewTextBoxColumn ColumnTotal3;
  22. //private DataGridViewTextBoxColumn ColumnTotal4;
  23. //private DataGridViewTextBoxColumn ColumnTotal5;
  24. //private DataGridViewTextBoxColumn ColumnTotal6;
  25. private DataGridViewTextBoxColumn Colum01;
  26. private DataGridViewTextBoxColumn Colum02;
  27. private DataGridViewTextBoxColumn Colum03;
  28. private DataGridViewTextBoxColumn Colum04;
  29. private DataGridViewTextBoxColumn Colum05;
  30. private DataGridViewTextBoxColumn Colum06;
  31. private GroupBox groupBox7;
  32. private Button button10;
  33. private Button button3;
  34. private Button button8;
  35. private RadioButton radioButton5;
  36. private RadioButton radioButton4;
  37. private RadioButton radioButton3;
  38. private Button button2;
  39. #endregion 组件
  40. #region 构造函数
  41. public MethodAreaDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem) : base(appWorkspace, menuItem, new Base.DedicatedAnalysis.GrainSize.Standard.GBT6394.MethodArea())
  42. {
  43. }
  44. #endregion 构造函数
  45. #region 初始化组件和实现组件事件
  46. private void InitializeComponentText()
  47. {
  48. //this.ColumnTotal1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  49. this.ColumnTotal2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  50. this.ColumnTotal3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  51. //this.ColumnTotal4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  52. //this.ColumnTotal5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  53. //this.ColumnTotal6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  54. this.Colum01 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  55. this.Colum02 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  56. this.Colum03 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  57. this.Colum04 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  58. this.Colum05 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  59. this.Colum06 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  60. this.groupBox_ShowParamSetting.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  61. this.button_ShowRefresh.Text = PdnResources.GetString("Menu.Refresh.text");
  62. this.checkBox_ShowGrainColor.Text = PdnResources.GetString("Menu.Thegrainsareshownindifferentcolors.text");
  63. this.checkBox_ShowGrainNumber.Text = PdnResources.GetString("Menu.Displaygrainnumber.text");
  64. this.checkBox_ShowGrid.Text = PdnResources.GetString("Menu.displaygrid.text");
  65. this.checkBox_ShowGrainBoundry.Text = PdnResources.GetString("Menu.displaygrainboundaries.text");
  66. this.ColumnTotal3.HeaderText = PdnResources.GetString("Menu.talnumberofgrain.Text");
  67. //this.ColumnTotal4.HeaderText = PdnResources.GetString("Menu.Summaryintercept.Text") + "(μm)";
  68. //this.ColumnTotal5.HeaderText = PdnResources.GetString("Menu.averageintercept.text") + "(μm)";
  69. //this.ColumnTotal6.HeaderText = PdnResources.GetString("Menu.calculatethelevel.Text");
  70. //this.ColumnTotal1.HeaderText = PdnResources.GetString("Menu.Averagesize.Text") + "(μm²)";
  71. this.ColumnTotal2.HeaderText = PdnResources.GetString("Menu.culatesthelevels.Text");
  72. this.Colum01.HeaderText = PdnResources.GetString("Menu.picture.Text");
  73. this.Colum02.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
  74. this.Colum03.HeaderText = PdnResources.GetString("Menu.Grainnumber.Text");
  75. this.Colum04.HeaderText = PdnResources.GetString("Menu.Graisize.Text") + "(μm²)";
  76. this.Colum05.HeaderText = PdnResources.GetString("Menu.Grainintercept.Text") + "(μm)";
  77. this.Colum06.HeaderText = PdnResources.GetString("Menu.Graingrade.Text");
  78. this.button2.Text = PdnResources.GetString("Menu.Setting.Text");
  79. this.Text = "GBT6394_2017(" + PdnResources.GetString("Menu.Areamethod.text") + ")";
  80. this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  81. this.ColumnTotal3,
  82. //this.ColumnTotal4,
  83. //this.ColumnTotal5,
  84. //this.ColumnTotal6,
  85. //this.ColumnTotal1,
  86. this.ColumnTotal2});
  87. //
  88. // ColumnTotal3
  89. //
  90. this.ColumnTotal3.Name = "ColumnTotal3";
  91. this.ColumnTotal3.ReadOnly = true;
  92. this.ColumnTotal3.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  93. ////
  94. //// ColumnTotal4
  95. ////
  96. //this.ColumnTotal4.Name = "ColumnTotal4";
  97. //this.ColumnTotal4.ReadOnly = true;
  98. ////
  99. //// ColumnTotal5
  100. ////
  101. //this.ColumnTotal5.Name = "ColumnTotal5";
  102. //this.ColumnTotal5.ReadOnly = true;
  103. ////
  104. //// ColumnTotal6
  105. ////
  106. //this.ColumnTotal6.Name = "ColumnTotal6";
  107. //this.ColumnTotal6.ReadOnly = true;
  108. ////
  109. //// ColumnTotal1
  110. ////
  111. //this.ColumnTotal1.Name = "ColumnTotal1";
  112. //this.ColumnTotal1.ReadOnly = true;
  113. //
  114. // ColumnTotal2
  115. //
  116. this.ColumnTotal2.Name = "ColumnTotal2";
  117. this.ColumnTotal2.ReadOnly = true;
  118. this.ColumnTotal2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  119. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  120. this.Colum01,
  121. this.Colum02,
  122. this.Colum03,
  123. this.Colum04,
  124. this.Colum05,
  125. this.Colum06});
  126. //
  127. // Colum01
  128. //
  129. this.Colum01.Name = "Colum01";
  130. this.Colum01.ReadOnly = true;
  131. //
  132. // Colum02
  133. //
  134. this.Colum02.Name = "Colum02";
  135. this.Colum02.ReadOnly = true;
  136. //
  137. // Colum03
  138. //
  139. this.Colum03.Name = "Grainnumber";
  140. this.Colum03.ReadOnly = true;
  141. //
  142. // Colum04
  143. //
  144. this.Colum04.Name = "Graisize";
  145. this.Colum04.ReadOnly = true;
  146. //
  147. // Colum05
  148. //
  149. this.Colum05.Name = "Grainintercept";
  150. this.Colum05.ReadOnly = true;
  151. //
  152. // Colum06
  153. //
  154. this.Colum06.Name = "Graingrade";
  155. this.Colum06.ReadOnly = true;
  156. //this.groupBox10.Text = PdnResources.GetString("Menu.sectionoperation.text");
  157. }
  158. private void InitializeComponent()
  159. {
  160. this.groupBox_ShowParamSetting = new System.Windows.Forms.GroupBox();
  161. this.button2 = new System.Windows.Forms.Button();
  162. this.button_ShowRefresh = new System.Windows.Forms.Button();
  163. this.checkBox_ShowGrainColor = new System.Windows.Forms.CheckBox();
  164. this.checkBox_ShowGrainNumber = new System.Windows.Forms.CheckBox();
  165. this.checkBox_ShowGrid = new System.Windows.Forms.CheckBox();
  166. this.checkBox_ShowGrainBoundry = new System.Windows.Forms.CheckBox();
  167. this.groupBox7 = new System.Windows.Forms.GroupBox();
  168. this.button10 = new System.Windows.Forms.Button();
  169. this.button3 = new System.Windows.Forms.Button();
  170. this.button8 = new System.Windows.Forms.Button();
  171. this.radioButton5 = new System.Windows.Forms.RadioButton();
  172. this.radioButton4 = new System.Windows.Forms.RadioButton();
  173. this.radioButton3 = new System.Windows.Forms.RadioButton();
  174. this.groupBox_img.SuspendLayout();
  175. this.groupBox_analysisResult1.SuspendLayout();
  176. this.groupBox3.SuspendLayout();
  177. this.groupBox_ShowParamSetting.SuspendLayout();
  178. this.groupBox7.SuspendLayout();
  179. this.SuspendLayout();
  180. //
  181. // groupBox_ShowParamSetting
  182. //
  183. this.groupBox_ShowParamSetting.Controls.Add(this.button2);
  184. this.groupBox_ShowParamSetting.Controls.Add(this.button_ShowRefresh);
  185. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainColor);
  186. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainNumber);
  187. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrid);
  188. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainBoundry);
  189. this.groupBox_ShowParamSetting.Location = new System.Drawing.Point(178, 370);
  190. this.groupBox_ShowParamSetting.Name = "groupBox_ShowParamSetting";
  191. this.groupBox_ShowParamSetting.Size = new System.Drawing.Size(356, 74);
  192. this.groupBox_ShowParamSetting.TabIndex = 38;
  193. this.groupBox_ShowParamSetting.TabStop = false;
  194. //
  195. // button2
  196. //
  197. this.button2.Anchor = System.Windows.Forms.AnchorStyles.Right;
  198. this.button2.Location = new System.Drawing.Point(271, 41);
  199. this.button2.Name = "button2";
  200. this.button2.Size = new System.Drawing.Size(75, 22);
  201. this.button2.TabIndex = 19;
  202. this.button2.UseVisualStyleBackColor = true;
  203. this.button2.Click += new System.EventHandler(this.button2_Click);
  204. //
  205. // button_ShowRefresh
  206. //
  207. this.button_ShowRefresh.Anchor = System.Windows.Forms.AnchorStyles.Right;
  208. this.button_ShowRefresh.Location = new System.Drawing.Point(271, 17);
  209. this.button_ShowRefresh.Name = "button_ShowRefresh";
  210. this.button_ShowRefresh.Size = new System.Drawing.Size(75, 22);
  211. this.button_ShowRefresh.TabIndex = 18;
  212. this.button_ShowRefresh.UseVisualStyleBackColor = true;
  213. this.button_ShowRefresh.Click += new System.EventHandler(this.button_ShowRefresh_Click);
  214. //
  215. // checkBox_ShowGrainColor
  216. //
  217. this.checkBox_ShowGrainColor.AutoSize = true;
  218. this.checkBox_ShowGrainColor.Checked = true;
  219. this.checkBox_ShowGrainColor.CheckState = System.Windows.Forms.CheckState.Checked;
  220. this.checkBox_ShowGrainColor.Location = new System.Drawing.Point(108, 44);
  221. this.checkBox_ShowGrainColor.Name = "checkBox_ShowGrainColor";
  222. this.checkBox_ShowGrainColor.Size = new System.Drawing.Size(15, 14);
  223. this.checkBox_ShowGrainColor.TabIndex = 3;
  224. this.checkBox_ShowGrainColor.UseVisualStyleBackColor = true;
  225. this.checkBox_ShowGrainColor.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainColor_CheckedChanged);
  226. //
  227. // checkBox_ShowGrainNumber
  228. //
  229. this.checkBox_ShowGrainNumber.AutoSize = true;
  230. this.checkBox_ShowGrainNumber.Checked = true;
  231. this.checkBox_ShowGrainNumber.CheckState = System.Windows.Forms.CheckState.Checked;
  232. this.checkBox_ShowGrainNumber.Location = new System.Drawing.Point(109, 22);
  233. this.checkBox_ShowGrainNumber.Name = "checkBox_ShowGrainNumber";
  234. this.checkBox_ShowGrainNumber.Size = new System.Drawing.Size(15, 14);
  235. this.checkBox_ShowGrainNumber.TabIndex = 2;
  236. this.checkBox_ShowGrainNumber.UseVisualStyleBackColor = true;
  237. this.checkBox_ShowGrainNumber.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainNumber_CheckedChanged);
  238. //
  239. // checkBox_ShowGrid
  240. //
  241. this.checkBox_ShowGrid.AutoSize = true;
  242. this.checkBox_ShowGrid.Checked = true;
  243. this.checkBox_ShowGrid.CheckState = System.Windows.Forms.CheckState.Checked;
  244. this.checkBox_ShowGrid.Location = new System.Drawing.Point(15, 44);
  245. this.checkBox_ShowGrid.Name = "checkBox_ShowGrid";
  246. this.checkBox_ShowGrid.Size = new System.Drawing.Size(15, 14);
  247. this.checkBox_ShowGrid.TabIndex = 1;
  248. this.checkBox_ShowGrid.UseVisualStyleBackColor = true;
  249. this.checkBox_ShowGrid.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrid_CheckedChanged);
  250. //
  251. // checkBox_ShowGrainBoundry
  252. //
  253. this.checkBox_ShowGrainBoundry.AutoSize = true;
  254. this.checkBox_ShowGrainBoundry.Checked = true;
  255. this.checkBox_ShowGrainBoundry.CheckState = System.Windows.Forms.CheckState.Checked;
  256. this.checkBox_ShowGrainBoundry.Location = new System.Drawing.Point(15, 22);
  257. this.checkBox_ShowGrainBoundry.Name = "checkBox_ShowGrainBoundry";
  258. this.checkBox_ShowGrainBoundry.Size = new System.Drawing.Size(15, 14);
  259. this.checkBox_ShowGrainBoundry.TabIndex = 0;
  260. this.checkBox_ShowGrainBoundry.UseVisualStyleBackColor = true;
  261. this.checkBox_ShowGrainBoundry.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainBoundry_CheckedChanged);
  262. //
  263. // groupBox7
  264. //
  265. this.groupBox7.Controls.Add(this.button10);
  266. this.groupBox7.Controls.Add(this.button3);
  267. this.groupBox7.Controls.Add(this.button8);
  268. this.groupBox7.Controls.Add(this.radioButton5);
  269. this.groupBox7.Controls.Add(this.radioButton4);
  270. this.groupBox7.Controls.Add(this.radioButton3);
  271. this.groupBox7.Location = new System.Drawing.Point(179, 450);
  272. this.groupBox7.Name = "groupBox7";
  273. this.groupBox7.Size = new System.Drawing.Size(355, 77);
  274. this.groupBox7.TabIndex = 39;
  275. this.groupBox7.TabStop = false;
  276. this.groupBox7.Text = "目标选择";
  277. //
  278. // button10
  279. //
  280. this.button10.Location = new System.Drawing.Point(60, 21);
  281. this.button10.Name = "button10";
  282. this.button10.Size = new System.Drawing.Size(40, 40);
  283. this.button10.TabIndex = 5;
  284. this.button10.UseVisualStyleBackColor = true;
  285. //
  286. // button3
  287. //
  288. this.button3.Location = new System.Drawing.Point(14, 21);
  289. this.button3.Name = "button3";
  290. this.button3.Size = new System.Drawing.Size(40, 40);
  291. this.button3.TabIndex = 4;
  292. this.button3.UseVisualStyleBackColor = true;
  293. //
  294. // button8
  295. //
  296. this.button8.Location = new System.Drawing.Point(106, 21);
  297. this.button8.Name = "button8";
  298. this.button8.Size = new System.Drawing.Size(40, 40);
  299. this.button8.TabIndex = 3;
  300. this.button8.UseVisualStyleBackColor = true;
  301. this.button8.Visible = false;
  302. //
  303. // radioButton5
  304. //
  305. this.radioButton5.AutoSize = true;
  306. this.radioButton5.Location = new System.Drawing.Point(238, 55);
  307. this.radioButton5.Name = "radioButton5";
  308. this.radioButton5.Size = new System.Drawing.Size(14, 13);
  309. this.radioButton5.TabIndex = 2;
  310. this.radioButton5.UseVisualStyleBackColor = true;
  311. this.radioButton5.Visible = false;
  312. //
  313. // radioButton4
  314. //
  315. this.radioButton4.AutoSize = true;
  316. this.radioButton4.Checked = true;
  317. this.radioButton4.Location = new System.Drawing.Point(297, 44);
  318. this.radioButton4.Name = "radioButton4";
  319. this.radioButton4.Size = new System.Drawing.Size(14, 13);
  320. this.radioButton4.TabIndex = 1;
  321. this.radioButton4.TabStop = true;
  322. this.radioButton4.UseVisualStyleBackColor = true;
  323. this.radioButton4.Visible = false;
  324. //
  325. // radioButton3
  326. //
  327. this.radioButton3.AutoSize = true;
  328. this.radioButton3.Location = new System.Drawing.Point(279, 21);
  329. this.radioButton3.Name = "radioButton3";
  330. this.radioButton3.Size = new System.Drawing.Size(14, 13);
  331. this.radioButton3.TabIndex = 0;
  332. this.radioButton3.UseVisualStyleBackColor = true;
  333. this.radioButton3.Visible = false;
  334. //
  335. // MethodAreaDialog
  336. //
  337. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  338. this.ClientSize = new System.Drawing.Size(1127, 810);
  339. this.Controls.Add(this.groupBox7);
  340. this.Controls.Add(this.groupBox_ShowParamSetting);
  341. this.Name = "MethodAreaDialog";
  342. this.Load += new System.EventHandler(this.MethodAreaDialog_Load);
  343. this.Controls.SetChildIndex(this.groupBox3, 0);
  344. this.Controls.SetChildIndex(this.groupBox_img, 0);
  345. this.Controls.SetChildIndex(this.groupBox_review, 0);
  346. this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
  347. this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
  348. this.Controls.SetChildIndex(this.groupBox_report, 0);
  349. this.Controls.SetChildIndex(this.groupBox_ShowParamSetting, 0);
  350. this.Controls.SetChildIndex(this.groupBox7, 0);
  351. this.groupBox_img.ResumeLayout(false);
  352. this.groupBox_analysisResult1.ResumeLayout(false);
  353. this.groupBox3.ResumeLayout(false);
  354. this.groupBox_ShowParamSetting.ResumeLayout(false);
  355. this.groupBox_ShowParamSetting.PerformLayout();
  356. this.groupBox7.ResumeLayout(false);
  357. this.groupBox7.PerformLayout();
  358. this.ResumeLayout(false);
  359. }
  360. private void MethodAreaDialog_Load(object sender, EventArgs e)
  361. {
  362. object ShowGrainBoundry;
  363. if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
  364. this.checkBox_ShowGrainBoundry.Checked = (bool)ShowGrainBoundry;
  365. if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
  366. this.checkBox_ShowGrid.Checked = (bool)ShowGrainBoundry;
  367. if (GetParamValue1(ParamKey_ShowGrainNumber, out ShowGrainBoundry))//显示晶粒编号
  368. this.checkBox_ShowGrainNumber.Checked = (bool)ShowGrainBoundry;
  369. if (GetParamValue1(ParamKey_ShowGrainColor, out ShowGrainBoundry))//用不同颜色显示晶粒
  370. this.checkBox_ShowGrainColor.Checked = (bool)ShowGrainBoundry;
  371. this.button3.FlatStyle = FlatStyle.Flat;
  372. this.button3.FlatAppearance.BorderSize = 0;
  373. this.button3.BackgroundImageLayout = ImageLayout.Zoom;
  374. this.button3.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle2.png").Reference;
  375. this.button3.Click += new EventHandler(this.button3_click);
  376. this.button10.FlatStyle = FlatStyle.Flat;
  377. this.button10.FlatAppearance.BorderSize = 0;
  378. this.button10.BackgroundImageLayout = ImageLayout.Zoom;
  379. this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
  380. this.button10.Click += new EventHandler(this.button10_click);
  381. this.button8.FlatStyle = FlatStyle.Flat;
  382. this.button8.FlatAppearance.BorderSize = 0;
  383. this.button8.BackgroundImageLayout = ImageLayout.Zoom;
  384. this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
  385. this.button8.Click += new EventHandler(this.button8_click);
  386. getSonData();
  387. }
  388. /// <summary>
  389. /// 获取参数
  390. /// </summary>
  391. protected override void getSonData()
  392. {
  393. object ShowGrainBoundry;
  394. if (GetParamValue1(ParamKey_TargetSelection, out ShowGrainBoundry))//目标选择
  395. {
  396. int value = Convert.ToInt32(ShowGrainBoundry);
  397. switch (value)
  398. {
  399. case 1:
  400. this.button8_click(null, null);
  401. break;
  402. case 2:
  403. this.button3_click(null, null);
  404. break;
  405. case 3:
  406. this.button10_click(null, null);
  407. break;
  408. }
  409. }
  410. }
  411. private void button3_click(object sender, EventArgs e)
  412. {
  413. this.TargetSelection = 2;
  414. this.radioButton4.Checked = true;
  415. this.button3.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle2.png").Reference;
  416. this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
  417. this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
  418. }
  419. private void button10_click(object sender, EventArgs e)
  420. {
  421. this.TargetSelection = 3;
  422. this.radioButton5.Checked = true;
  423. this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle3.png").Reference;
  424. this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
  425. this.button3.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray2.png").Reference;
  426. }
  427. private void button8_click(object sender, EventArgs e)
  428. {
  429. this.TargetSelection = 1;
  430. this.radioButton3.Checked = true;
  431. this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle1.png").Reference;
  432. this.button3.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray2.png").Reference;
  433. this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
  434. }
  435. /// <summary>
  436. /// 设置晶粒颜色
  437. /// </summary>
  438. /// <param name="sender"></param>
  439. /// <param name="e"></param>
  440. private void button2_Click(object sender, EventArgs e)
  441. {
  442. //if (this.matOrg == null)
  443. //{
  444. // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
  445. // return;
  446. //}
  447. ShowGrainColorSettingDialog();
  448. }
  449. /// <summary>
  450. /// 刷新晶粒编号
  451. /// </summary>
  452. /// <param name="sender"></param>
  453. /// <param name="e"></param>
  454. private void button_ShowRefresh_Click(object sender, EventArgs e)
  455. {
  456. if (this.imageMat == null)
  457. {
  458. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
  459. return;
  460. }
  461. // 是否矩形辅助线
  462. int isRect;
  463. double aec0 = GSSClass.GuideClass.guideArea(GSSClass.GuideClass.guideModel, GSSClass.GuideClass.guideModel.oldSelectItem/*this.comboBox1.SelectedItem*/, out isRect, getGbtType());
  464. GetNumberOfGrains(null, null, null, -1, isRect == 1); //ProgressThreadProcClass.StartProgressAutoThread(this, ProgressThreadEvent, null);//
  465. }
  466. //public void ProgressThreadEvent(string str)
  467. //{
  468. // System.Console.WriteLine("委托传回的消息:" + str);
  469. // GetNumberOfGrains();
  470. //}
  471. /// <summary>
  472. /// 显示晶界状态改变
  473. /// </summary>
  474. /// <param name="sender"></param>
  475. /// <param name="e"></param>
  476. private void checkBox_ShowGrainBoundry_CheckedChanged(object sender, EventArgs e)
  477. {
  478. this.documentWorkspace.PhaseModels[1].choise = (!bcOriginChecked() && getGrainBoundryChecked() && checkBox_ShowGrainBoundry.Checked);
  479. this.documentWorkspace.Refresh();
  480. }
  481. /// <summary>
  482. /// 显示网格状态改变
  483. /// </summary>
  484. /// <param name="sender"></param>
  485. /// <param name="e"></param>
  486. private void checkBox_ShowGrid_CheckedChanged(object sender, EventArgs e)
  487. {
  488. this.documentWorkspace.Refresh();
  489. }
  490. /// <summary>
  491. /// 用不同颜色显示晶粒状态改变
  492. /// </summary>
  493. /// <param name="sender"></param>
  494. /// <param name="e"></param>
  495. private void checkBox_ShowGrainColor_CheckedChanged(object sender, EventArgs e)
  496. {
  497. this.documentWorkspace.PhaseModels[2].choise = (!bcOriginChecked() && checkBox_ShowGrainColor.Checked);
  498. this.documentWorkspace.Refresh();
  499. }
  500. /// <summary>
  501. /// 显示晶粒编号状态改变
  502. /// </summary>
  503. /// <param name="sender"></param>
  504. /// <param name="e"></param>
  505. private void checkBox_ShowGrainNumber_CheckedChanged(object sender, EventArgs e)
  506. {
  507. this.documentWorkspace.Refresh();
  508. }
  509. #endregion 初始化组件和实现组件事件
  510. #region 需继承方法
  511. ////数据库的name(报告模板)
  512. //protected override string getTemplateName()
  513. //{
  514. // return "Template.Manager.item3.GrainSizeArea6394Method";
  515. //}
  516. //语言包的name(项目工程)
  517. protected override string getProjectEngineeringName()
  518. {
  519. return "Menu.DedicatedAnalysis.BlackMetal.GrainSize.Text";
  520. }
  521. ////配置文件名称(辅助线)
  522. //protected override string getModelName()
  523. //{
  524. // return "GrainSizeGuideAreaMethodModel.xml";
  525. //}
  526. //辅助线类型名称
  527. protected override string[] getTypeNames()
  528. {
  529. return new string[] {
  530. PdnResources.GetString("Menu.circular.Text"),
  531. PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text")};
  532. }
  533. protected override int getGbtType()
  534. {
  535. return 3;
  536. }
  537. protected override void SubclassInitialize()
  538. {
  539. InitializeComponent();
  540. InitializeComponentText();
  541. DetailListNotDoubleIndex.Add(0);
  542. DetailListNotDoubleIndex.Add(1);
  543. }
  544. //切换图片时控制前一张图的信息不遗留显示
  545. protected override void refreshWhileImgChanged()
  546. {
  547. if (this.grainColorsMatDict.ContainsKey(getCurrentWorkTag()))
  548. this.documentWorkspace.PhaseModels[2].mat = this.grainColorsMatDict[getCurrentWorkTag()];
  549. if (this.imageMat != null && this.documentWorkspace.PhaseModels[2].mat != null)
  550. {
  551. //try//#######################################
  552. //{
  553. // GetNumberOfGrains();
  554. //}
  555. //catch (Exception)
  556. //{
  557. //}
  558. }
  559. else
  560. {
  561. this.documentWorkspace.PhaseModels[2].mat = null;//清空前一张图的信息不遗留显示
  562. GSSClass.standardModel.massLabelPoints.Clear();//1013###19098(切换图片的时候前一张图的信息不遗留显示)}
  563. //1013###18808(切换图片的时候前一张图的信息不遗留显示)
  564. this.documentWorkspace.Refresh();
  565. }
  566. }
  567. /// <summary>
  568. /// 是否用不同颜色显示晶粒
  569. /// </summary>
  570. /// <returns></returns>
  571. protected override Boolean ShowGrainColorChecked()
  572. {
  573. return checkBox_ShowGrainColor.Checked;
  574. }
  575. //是否绘制编号
  576. protected override bool showGrainNumberChecked()
  577. {
  578. return this.checkBox_ShowGrainNumber.Checked;
  579. }
  580. //是否绘制辅助线
  581. protected override bool showGridChecked()
  582. {
  583. return checkBox_ShowGrid.Checked;
  584. }
  585. /// <summary>
  586. /// 是否显示晶界
  587. /// </summary>
  588. /// <returns></returns>
  589. protected override Boolean ShowGrainBoundryChecked()
  590. {
  591. return checkBox_ShowGrainBoundry.Checked;
  592. }
  593. #endregion
  594. }
  595. }