MethodKDialog.cs 16 KB

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