MethodADialog.cs 17 KB

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