MethodADialog.cs 17 KB

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