MethodMDialog.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 MethodMDialog : 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 MethodMDialog(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(160, 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(67, 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(100, 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(127, 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(187, 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(220, 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. // MethodMDialog
  189. //
  190. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  191. this.ClientSize = new System.Drawing.Size(1177, 908);
  192. this.Name = "MethodMDialog";
  193. this.Text = "DIN50602_1985_MethodM("+ PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text")+ ")";
  194. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  195. this.groupBox_colorSetting.ResumeLayout(false);
  196. this.groupBox_colorSetting.PerformLayout();
  197. this.groupBox_displaySetting.ResumeLayout(false);
  198. this.groupBox_displaySetting.PerformLayout();
  199. this.ResumeLayout(false);
  200. }
  201. #endregion 初始化组件
  202. #region 需继承方法
  203. protected override void SubclassInitialize()
  204. {
  205. InitializeComponent();
  206. this.radioButton_Black.Checked = true;
  207. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  208. }
  209. protected override MethodOfAssessment getMethodOfAssessment()
  210. {
  211. return new MethodM(this.imgPxPerUnit);
  212. }
  213. protected override void initColorSetting()
  214. {
  215. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  216. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  217. this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  218. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  219. }
  220. protected override void initDisplaySetting()
  221. {
  222. this.panel_displaySetting_SS.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["SS"].showColor);
  223. this.panel_displaySetting_OS.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["OS"].showColor);
  224. this.panel_displaySetting_OA.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["OA"].showColor);
  225. this.panel_displaySetting_OG.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["OG"].showColor);
  226. }
  227. protected override void getInclusionParameters()
  228. {
  229. switch (whichChecked)
  230. {
  231. case 0:
  232. radioButton_Black.Checked = true;
  233. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  234. break;
  235. case 1:
  236. radioButton_Black.Checked = true;
  237. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"];
  238. break;
  239. case 2:
  240. radioButton_LightBlue.Checked = true;
  241. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["LightBlue"];
  242. break;
  243. case 3:
  244. radioButton_Gray.Checked = true;
  245. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Gray"];
  246. break;
  247. case 4:
  248. radioButton_DarkGray.Checked = true;
  249. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["DarkGray"];
  250. break;
  251. }
  252. }
  253. protected override void saveInclusionParameters()
  254. {
  255. if (radioButton_Black.Checked)
  256. {
  257. thisParameters.parameter3 = 1;
  258. }
  259. else if (radioButton_LightBlue.Checked)
  260. {
  261. thisParameters.parameter3 = 2;
  262. }
  263. else if (radioButton_Gray.Checked)
  264. {
  265. thisParameters.parameter3 = 3;
  266. }
  267. else if (radioButton_DarkGray.Checked)
  268. {
  269. thisParameters.parameter3 = 4;
  270. }
  271. }
  272. protected override void getOldCheck()
  273. {
  274. this.radioButton_Black.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  275. this.radioButton_Gray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  276. this.radioButton_LightBlue.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  277. this.radioButton_DarkGray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton);
  278. switch (colorName)
  279. {
  280. case "Black":
  281. radioButton_Black.Checked = true;
  282. break;
  283. case "Gray":
  284. radioButton_Gray.Checked = true;
  285. break;
  286. case "DarkGray":
  287. radioButton_DarkGray.Checked = true;
  288. break;
  289. case "LightBlue":
  290. radioButton_LightBlue.Checked = true;
  291. break;
  292. }
  293. this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  294. this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  295. this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  296. this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton);
  297. }
  298. #endregion 需继承方法
  299. }
  300. }