MethodDDialog.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. using PaintDotNet.Base.DedicatedAnalysis.Inclusions;
  2. using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Standard.ASTME45;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PaintDotNet.DedicatedAnalysis.Inclusions.ASTME45
  13. {
  14. internal class MethodDDialog : InclusionsStandardDialog
  15. {
  16. #region 组件
  17. private RadioButton radioButton_DarkGray;
  18. private RadioButton radioButton_Gray;
  19. private RadioButton radioButton_LightBlue;
  20. private Panel panel_displaySetting_A;
  21. private Panel panel_displaySetting_C;
  22. private Button label_displaySetting_D;
  23. private Panel panel_displaySetting_B;
  24. private Panel panel_displaySetting_D;
  25. private Button label_displaySetting_C;
  26. private Button label_displaySetting_A;
  27. private Button label_displaySetting_B;
  28. private RadioButton radioButton_Black;
  29. #endregion 组件
  30. #region 构造函数
  31. public MethodDDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem) : base(appWorkspace, dialogText, menuItem)
  32. {
  33. }
  34. #endregion 构造函数
  35. #region 初始化组件
  36. private void InitializeComponent()
  37. {
  38. this.radioButton_DarkGray = new System.Windows.Forms.RadioButton();
  39. this.radioButton_Gray = new System.Windows.Forms.RadioButton();
  40. this.radioButton_LightBlue = new System.Windows.Forms.RadioButton();
  41. this.radioButton_Black = new System.Windows.Forms.RadioButton();
  42. this.panel_displaySetting_A = new System.Windows.Forms.Panel();
  43. this.panel_displaySetting_C = new System.Windows.Forms.Panel();
  44. this.label_displaySetting_D = new System.Windows.Forms.Button();
  45. this.panel_displaySetting_B = new System.Windows.Forms.Panel();
  46. this.panel_displaySetting_D = new System.Windows.Forms.Panel();
  47. this.label_displaySetting_C = new System.Windows.Forms.Button();
  48. this.label_displaySetting_A = new System.Windows.Forms.Button();
  49. this.label_displaySetting_B = new System.Windows.Forms.Button();
  50. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
  51. this.groupBox_colorSetting.SuspendLayout();
  52. this.groupBox_displaySetting.SuspendLayout();
  53. this.SuspendLayout();
  54. //
  55. // numericUpDown_lwRatioLimit
  56. //
  57. this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
  58. 2,
  59. 0,
  60. 0,
  61. 0});
  62. //
  63. // groupBox_colorSetting
  64. //
  65. this.groupBox_colorSetting.Controls.Add(this.radioButton_DarkGray);
  66. this.groupBox_colorSetting.Controls.Add(this.radioButton_Gray);
  67. this.groupBox_colorSetting.Controls.Add(this.radioButton_LightBlue);
  68. this.groupBox_colorSetting.Controls.Add(this.radioButton_Black);
  69. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Black, 0);
  70. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_LightBlue, 0);
  71. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Gray, 0);
  72. this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_DarkGray, 0);
  73. //
  74. // groupBox_displaySetting
  75. //
  76. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_A);
  77. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_C);
  78. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_D);
  79. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_B);
  80. this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_D);
  81. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_C);
  82. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_A);
  83. this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_B);
  84. //
  85. // radioButton_DarkGray
  86. //
  87. this.radioButton_DarkGray.AutoSize = true;
  88. this.radioButton_DarkGray.Location = new System.Drawing.Point(178, 20);
  89. this.radioButton_DarkGray.Name = "radioButton_DarkGray";
  90. this.radioButton_DarkGray.Size = new System.Drawing.Size(59, 16);
  91. this.radioButton_DarkGray.TabIndex = 38;
  92. this.radioButton_DarkGray.TabStop = true;
  93. this.radioButton_DarkGray.Text = PdnResources.GetString("Menu.Darkgray.text");
  94. this.radioButton_DarkGray.UseVisualStyleBackColor = true;
  95. //
  96. // radioButton_Gray
  97. //
  98. this.radioButton_Gray.AutoSize = true;
  99. this.radioButton_Gray.Location = new System.Drawing.Point(125, 20);
  100. this.radioButton_Gray.Name = "radioButton_Gray";
  101. this.radioButton_Gray.Size = new System.Drawing.Size(47, 16);
  102. this.radioButton_Gray.TabIndex = 37;
  103. this.radioButton_Gray.TabStop = true;
  104. this.radioButton_Gray.Text = PdnResources.GetString("Menu.gray.text");
  105. this.radioButton_Gray.UseVisualStyleBackColor = true;
  106. //
  107. // radioButton_LightBlue
  108. //
  109. this.radioButton_LightBlue.AutoSize = true;
  110. this.radioButton_LightBlue.Location = new System.Drawing.Point(60, 20);
  111. this.radioButton_LightBlue.Name = "radioButton_LightBlue";
  112. this.radioButton_LightBlue.Size = new System.Drawing.Size(59, 16);
  113. this.radioButton_LightBlue.TabIndex = 36;
  114. this.radioButton_LightBlue.TabStop = true;
  115. this.radioButton_LightBlue.Text = PdnResources.GetString("Menu.Bluish.text");
  116. this.radioButton_LightBlue.UseVisualStyleBackColor = true;
  117. //
  118. // radioButton_Black
  119. //
  120. this.radioButton_Black.AutoSize = true;
  121. this.radioButton_Black.Location = new System.Drawing.Point(7, 20);
  122. this.radioButton_Black.Name = "radioButton_Black";
  123. this.radioButton_Black.Size = new System.Drawing.Size(47, 16);
  124. this.radioButton_Black.TabIndex = 35;
  125. this.radioButton_Black.TabStop = true;
  126. this.radioButton_Black.Text = PdnResources.GetString("Menu.black.text");
  127. this.radioButton_Black.UseVisualStyleBackColor = true;
  128. //
  129. // panel_displaySetting_A
  130. //
  131. this.panel_displaySetting_A.Location = new System.Drawing.Point(40, 25);
  132. this.panel_displaySetting_A.Name = "panel_displaySetting_A";
  133. this.panel_displaySetting_A.Size = new System.Drawing.Size(21, 21);
  134. this.panel_displaySetting_A.TabIndex = 34;
  135. //
  136. // panel_displaySetting_C
  137. //
  138. this.panel_displaySetting_C.BackColor = System.Drawing.SystemColors.Control;
  139. this.panel_displaySetting_C.Location = new System.Drawing.Point(146, 25);
  140. this.panel_displaySetting_C.Name = "panel_displaySetting_C";
  141. this.panel_displaySetting_C.Size = new System.Drawing.Size(21, 21);
  142. this.panel_displaySetting_C.TabIndex = 35;
  143. //
  144. // label_displaySetting_D
  145. //
  146. this.label_displaySetting_D.AutoSize = true;
  147. this.label_displaySetting_D.Location = new System.Drawing.Point(173, 25);
  148. this.label_displaySetting_D.Name = "label_displaySetting_D";
  149. this.label_displaySetting_D.Size = new System.Drawing.Size(21, 22);
  150. this.label_displaySetting_D.TabIndex = 41;
  151. this.label_displaySetting_D.Text = "D";
  152. //
  153. // panel_displaySetting_B
  154. //
  155. this.panel_displaySetting_B.BackColor = System.Drawing.SystemColors.Control;
  156. this.panel_displaySetting_B.Location = new System.Drawing.Point(92, 25);
  157. this.panel_displaySetting_B.Name = "panel_displaySetting_B";
  158. this.panel_displaySetting_B.Size = new System.Drawing.Size(21, 21);
  159. this.panel_displaySetting_B.TabIndex = 33;
  160. //
  161. // panel_displaySetting_D
  162. //
  163. this.panel_displaySetting_D.BackColor = System.Drawing.SystemColors.Control;
  164. this.panel_displaySetting_D.Location = new System.Drawing.Point(200, 25);
  165. this.panel_displaySetting_D.Name = "panel_displaySetting_D";
  166. this.panel_displaySetting_D.Size = new System.Drawing.Size(21, 21);
  167. this.panel_displaySetting_D.TabIndex = 36;
  168. //
  169. // label_displaySetting_C
  170. //
  171. this.label_displaySetting_C.AutoSize = true;
  172. this.label_displaySetting_C.Location = new System.Drawing.Point(119, 25);
  173. this.label_displaySetting_C.Name = "label_displaySetting_C";
  174. this.label_displaySetting_C.Size = new System.Drawing.Size(21, 22);
  175. this.label_displaySetting_C.TabIndex = 40;
  176. this.label_displaySetting_C.Text = "C";
  177. //
  178. // label_displaySetting_A
  179. //
  180. this.label_displaySetting_A.AutoSize = true;
  181. this.label_displaySetting_A.Location = new System.Drawing.Point(13, 25);
  182. this.label_displaySetting_A.Name = "label_displaySetting_A";
  183. this.label_displaySetting_A.Size = new System.Drawing.Size(21, 22);
  184. this.label_displaySetting_A.TabIndex = 38;
  185. this.label_displaySetting_A.Text = "A";
  186. //
  187. // label_displaySetting_B
  188. //
  189. this.label_displaySetting_B.AutoSize = true;
  190. this.label_displaySetting_B.Location = new System.Drawing.Point(67, 25);
  191. this.label_displaySetting_B.Name = "label_displaySetting_B";
  192. this.label_displaySetting_B.Size = new System.Drawing.Size(21, 22);
  193. this.label_displaySetting_B.TabIndex = 39;
  194. this.label_displaySetting_B.Text = "B";
  195. //
  196. // MethodDDialog
  197. //
  198. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  199. this.ClientSize = new System.Drawing.Size(1177, 908);
  200. this.Name = "MethodDDialog";
  201. this.Text = "ASTME45_MethodD("+ PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text")+ ")";
  202. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  203. this.groupBox_colorSetting.ResumeLayout(false);
  204. this.groupBox_colorSetting.PerformLayout();
  205. this.groupBox_displaySetting.ResumeLayout(false);
  206. this.groupBox_displaySetting.PerformLayout();
  207. this.ResumeLayout(false);
  208. }
  209. #endregion 初始化组件
  210. #region 需继承方法
  211. protected override void SubclassInitialize()
  212. {
  213. InitializeComponent();
  214. this.radioButton_Black.Checked = true;
  215. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  216. }
  217. protected override MethodOfAssessment getMethodOfAssessment()
  218. {
  219. return new MethodD(this.imgPxPerUnit);
  220. }
  221. protected override void initColorSetting()
  222. {
  223. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  224. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  225. this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  226. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  227. }
  228. protected override void initDisplaySetting()
  229. {
  230. this.panel_displaySetting_A.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["A"].showColor);
  231. this.panel_displaySetting_B.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["B"].showColor);
  232. this.panel_displaySetting_C.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["C"].showColor);
  233. this.panel_displaySetting_D.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["D"].showColor);
  234. }
  235. protected override void getInclusionParameters()
  236. {
  237. switch (whichChecked)
  238. {
  239. case 0:
  240. radioButton_Black.Checked = true;
  241. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  242. break;
  243. case 1:
  244. radioButton_Black.Checked = true;
  245. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  246. break;
  247. case 2:
  248. radioButton_LightBlue.Checked = true;
  249. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["LightBlue"];
  250. break;
  251. case 3:
  252. radioButton_Gray.Checked = true;
  253. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Gray"];
  254. break;
  255. case 4:
  256. radioButton_DarkGray.Checked = true;
  257. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["DarkGray"];
  258. break;
  259. }
  260. }
  261. protected override void saveInclusionParameters()
  262. {
  263. if (radioButton_Black.Checked)
  264. {
  265. thisParameters.parameter3 = 1;
  266. }
  267. else if (radioButton_LightBlue.Checked)
  268. {
  269. thisParameters.parameter3 = 2;
  270. }
  271. else if (radioButton_Gray.Checked)
  272. {
  273. thisParameters.parameter3 = 3;
  274. }
  275. else if (radioButton_DarkGray.Checked)
  276. {
  277. thisParameters.parameter3 = 4;
  278. }
  279. }
  280. protected override void getOldCheck()
  281. {
  282. this.radioButton_Black.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  283. this.radioButton_Gray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  284. this.radioButton_LightBlue.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  285. this.radioButton_DarkGray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  286. switch (colorName)
  287. {
  288. case "Black":
  289. radioButton_Black.Checked = true;
  290. break;
  291. case "Gray":
  292. radioButton_Gray.Checked = true;
  293. break;
  294. case "DarkGray":
  295. radioButton_DarkGray.Checked = true;
  296. break;
  297. case "LightBlue":
  298. radioButton_LightBlue.Checked = true;
  299. break;
  300. }
  301. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  302. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  303. this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  304. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  305. }
  306. #endregion 需继承方法
  307. }
  308. }