MethodAreaDialog.cs 28 KB

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