MethodBDialog.cs 17 KB

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