MethodAreaDialog.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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.E1181
  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.E1181.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.ColumnTotal3.HeaderText = PdnResources.GetString("Menu.talnumberofgrain.Text");
  54. this.ColumnTotal4.HeaderText = PdnResources.GetString("Menu.Summaryintercept.Text") + "(μm)";
  55. this.ColumnTotal5.HeaderText = PdnResources.GetString("Menu.averageintercept.text") + "(μm)";
  56. this.ColumnTotal6.HeaderText = PdnResources.GetString("Menu.calculatethelevel.Text");
  57. this.ColumnTotal1.HeaderText = PdnResources.GetString("Menu.Averagesize.Text") + "(μm²)";
  58. this.ColumnTotal2.HeaderText = PdnResources.GetString("Menu.culatesthelevels.Text");
  59. this.Colum01.HeaderText = PdnResources.GetString("Menu.picture.Text");
  60. this.Colum02.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
  61. this.Colum03.HeaderText = PdnResources.GetString("Menu.Grainnumber.Text");
  62. this.Colum04.HeaderText = PdnResources.GetString("Menu.Graisize.Text") + "(μm²)";
  63. this.Colum05.HeaderText = PdnResources.GetString("Menu.Grainintercept.Text") + "(μm)";
  64. this.Colum06.HeaderText = PdnResources.GetString("Menu.Graingrade.Text");
  65. this.button2.Text = PdnResources.GetString("Menu.Setting.Text");
  66. this.Text = "ASTM_E1181_2002(" + PdnResources.GetString("Menu.Areamethod.text") + ")";
  67. }
  68. private void InitializeComponent()
  69. {
  70. this.groupBox_ShowParamSetting = new System.Windows.Forms.GroupBox();
  71. this.button_ShowRefresh = new System.Windows.Forms.Button();
  72. this.checkBox_ShowGrainColor = new System.Windows.Forms.CheckBox();
  73. this.checkBox_ShowGrainNumber = new System.Windows.Forms.CheckBox();
  74. this.checkBox_ShowGrid = new System.Windows.Forms.CheckBox();
  75. this.checkBox_ShowGrainBoundry = new System.Windows.Forms.CheckBox();
  76. this.ColumnTotal1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  77. this.ColumnTotal2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  78. this.ColumnTotal3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  79. this.ColumnTotal4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  80. this.ColumnTotal5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  81. this.ColumnTotal6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  82. this.Colum01 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  83. this.Colum02 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  84. this.Colum03 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  85. this.Colum04 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  86. this.Colum05 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  87. this.Colum06 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  88. this.button2 = new System.Windows.Forms.Button();
  89. this.groupBox7 = new System.Windows.Forms.GroupBox();
  90. this.button10 = new System.Windows.Forms.Button();
  91. this.button3 = new System.Windows.Forms.Button();
  92. this.button8 = new System.Windows.Forms.Button();
  93. this.radioButton5 = new System.Windows.Forms.RadioButton();
  94. this.radioButton4 = new System.Windows.Forms.RadioButton();
  95. this.radioButton3 = new System.Windows.Forms.RadioButton();
  96. this.groupBox_img.SuspendLayout();
  97. this.groupBox_analysisResult1.SuspendLayout();
  98. this.groupBox3.SuspendLayout();
  99. this.groupBox_ShowParamSetting.SuspendLayout();
  100. this.groupBox7.SuspendLayout();
  101. this.SuspendLayout();
  102. //
  103. // groupBox_ShowParamSetting
  104. //
  105. this.groupBox_ShowParamSetting.Controls.Add(this.button2);
  106. this.groupBox_ShowParamSetting.Controls.Add(this.button_ShowRefresh);
  107. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainColor);
  108. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainNumber);
  109. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrid);
  110. this.groupBox_ShowParamSetting.Controls.Add(this.checkBox_ShowGrainBoundry);
  111. this.groupBox_ShowParamSetting.Location = new System.Drawing.Point(178, 370);
  112. this.groupBox_ShowParamSetting.Name = "groupBox_ShowParamSetting";
  113. this.groupBox_ShowParamSetting.Size = new System.Drawing.Size(356, 74);
  114. this.groupBox_ShowParamSetting.TabIndex = 38;
  115. this.groupBox_ShowParamSetting.TabStop = false;
  116. //
  117. // button_ShowRefresh
  118. //
  119. this.button_ShowRefresh.Anchor = System.Windows.Forms.AnchorStyles.Right;
  120. this.button_ShowRefresh.Location = new System.Drawing.Point(271, 17);
  121. this.button_ShowRefresh.Name = "button_ShowRefresh";
  122. this.button_ShowRefresh.Size = new System.Drawing.Size(75, 22);
  123. this.button_ShowRefresh.TabIndex = 18;
  124. this.button_ShowRefresh.UseVisualStyleBackColor = true;
  125. this.button_ShowRefresh.Click += new System.EventHandler(this.button_ShowRefresh_Click);
  126. //
  127. // checkBox_ShowGrainColor
  128. //
  129. this.checkBox_ShowGrainColor.AutoSize = true;
  130. this.checkBox_ShowGrainColor.Checked = true;
  131. this.checkBox_ShowGrainColor.CheckState = System.Windows.Forms.CheckState.Checked;
  132. this.checkBox_ShowGrainColor.Location = new System.Drawing.Point(108, 44);
  133. this.checkBox_ShowGrainColor.Name = "checkBox_ShowGrainColor";
  134. this.checkBox_ShowGrainColor.Size = new System.Drawing.Size(161, 19);
  135. this.checkBox_ShowGrainColor.TabIndex = 3;
  136. this.checkBox_ShowGrainColor.UseVisualStyleBackColor = true;
  137. this.checkBox_ShowGrainColor.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainColor_CheckedChanged);
  138. //
  139. // checkBox_ShowGrainNumber
  140. //
  141. this.checkBox_ShowGrainNumber.AutoSize = true;
  142. this.checkBox_ShowGrainNumber.Checked = true;
  143. this.checkBox_ShowGrainNumber.CheckState = System.Windows.Forms.CheckState.Checked;
  144. this.checkBox_ShowGrainNumber.Location = new System.Drawing.Point(109, 22);
  145. this.checkBox_ShowGrainNumber.Name = "checkBox_ShowGrainNumber";
  146. this.checkBox_ShowGrainNumber.Size = new System.Drawing.Size(116, 19);
  147. this.checkBox_ShowGrainNumber.TabIndex = 2;
  148. this.checkBox_ShowGrainNumber.UseVisualStyleBackColor = true;
  149. this.checkBox_ShowGrainNumber.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainNumber_CheckedChanged);
  150. //
  151. // checkBox_ShowGrid
  152. //
  153. this.checkBox_ShowGrid.AutoSize = true;
  154. this.checkBox_ShowGrid.Checked = true;
  155. this.checkBox_ShowGrid.CheckState = System.Windows.Forms.CheckState.Checked;
  156. this.checkBox_ShowGrid.Location = new System.Drawing.Point(15, 44);
  157. this.checkBox_ShowGrid.Name = "checkBox_ShowGrid";
  158. this.checkBox_ShowGrid.Size = new System.Drawing.Size(86, 19);
  159. this.checkBox_ShowGrid.TabIndex = 1;
  160. this.checkBox_ShowGrid.UseVisualStyleBackColor = true;
  161. this.checkBox_ShowGrid.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrid_CheckedChanged);
  162. //
  163. // checkBox_ShowGrainBoundry
  164. //
  165. this.checkBox_ShowGrainBoundry.AutoSize = true;
  166. this.checkBox_ShowGrainBoundry.Checked = true;
  167. this.checkBox_ShowGrainBoundry.CheckState = System.Windows.Forms.CheckState.Checked;
  168. this.checkBox_ShowGrainBoundry.Location = new System.Drawing.Point(15, 22);
  169. this.checkBox_ShowGrainBoundry.Name = "checkBox_ShowGrainBoundry";
  170. this.checkBox_ShowGrainBoundry.Size = new System.Drawing.Size(86, 19);
  171. this.checkBox_ShowGrainBoundry.TabIndex = 0;
  172. this.checkBox_ShowGrainBoundry.UseVisualStyleBackColor = true;
  173. this.checkBox_ShowGrainBoundry.CheckedChanged += new System.EventHandler(this.checkBox_ShowGrainBoundry_CheckedChanged);
  174. this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  175. this.ColumnTotal3,
  176. this.ColumnTotal4,
  177. this.ColumnTotal5,
  178. this.ColumnTotal6,
  179. this.ColumnTotal1,
  180. this.ColumnTotal2});
  181. //
  182. // ColumnTotal3
  183. //
  184. this.ColumnTotal3.Name = "ColumnTotal3";
  185. this.ColumnTotal3.ReadOnly = true;
  186. //
  187. // ColumnTotal4
  188. //
  189. this.ColumnTotal4.Name = "ColumnTotal4";
  190. this.ColumnTotal4.ReadOnly = true;
  191. //
  192. // ColumnTotal5
  193. //
  194. this.ColumnTotal5.Name = "ColumnTotal5";
  195. this.ColumnTotal5.ReadOnly = true;
  196. //
  197. // ColumnTotal6
  198. //
  199. this.ColumnTotal6.Name = "ColumnTotal6";
  200. this.ColumnTotal6.ReadOnly = true;
  201. //
  202. // ColumnTotal1
  203. //
  204. this.ColumnTotal1.Name = "ColumnTotal1";
  205. this.ColumnTotal1.ReadOnly = true;
  206. //
  207. // ColumnTotal2
  208. //
  209. this.ColumnTotal2.Name = "ColumnTotal2";
  210. this.ColumnTotal2.ReadOnly = true;
  211. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  212. this.Colum01,
  213. this.Colum02,
  214. this.Colum03,
  215. this.Colum04,
  216. this.Colum05,
  217. this.Colum06});
  218. //
  219. // Colum01
  220. //
  221. this.Colum01.Name = "Colum01";
  222. this.Colum01.ReadOnly = true;
  223. //
  224. // Colum02
  225. //
  226. this.Colum02.Name = "Colum02";
  227. this.Colum02.ReadOnly = true;
  228. //
  229. // Colum03
  230. //
  231. this.Colum03.Name = "Grainnumber";
  232. this.Colum03.ReadOnly = true;
  233. //
  234. // Colum04
  235. //
  236. this.Colum04.Name = "Graisize";
  237. this.Colum04.ReadOnly = true;
  238. //
  239. // Colum05
  240. //
  241. this.Colum05.Name = "Grainintercept";
  242. this.Colum05.ReadOnly = true;
  243. //
  244. // Colum06
  245. //
  246. this.Colum06.Name = "Graingrade";
  247. this.Colum06.ReadOnly = true;
  248. //
  249. // button2
  250. //
  251. this.button2.Anchor = System.Windows.Forms.AnchorStyles.Right;
  252. this.button2.Location = new System.Drawing.Point(271, 41);
  253. this.button2.Name = "button2";
  254. this.button2.Size = new System.Drawing.Size(75, 22);
  255. this.button2.TabIndex = 19;
  256. this.button2.UseVisualStyleBackColor = true;
  257. this.button2.Click += new System.EventHandler(this.button2_Click);
  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.matOrg == 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.GrainSizeArea1181Method";
  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. DetailListNotDoubleIndex.Add(0);
  525. DetailListNotDoubleIndex.Add(1);
  526. InitializeLanguageText();
  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.bitmap != 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. }