using PaintDotNet.Base.DedicatedAnalysis.Inclusions; using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Standard.ASTME45; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PaintDotNet.DedicatedAnalysis.Inclusions.ASTME45 { internal class MethodDDialog : InclusionsStandardDialog { #region 组件 private RadioButton radioButton_DarkGray; private RadioButton radioButton_Gray; private RadioButton radioButton_LightBlue; private Panel panel_displaySetting_A; private Panel panel_displaySetting_C; private Button label_displaySetting_D; private Panel panel_displaySetting_B; private Panel panel_displaySetting_D; private Button label_displaySetting_C; private Button label_displaySetting_A; private Button label_displaySetting_B; private RadioButton radioButton_Black; #endregion 组件 #region 构造函数 public MethodDDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem) : base(appWorkspace, dialogText, menuItem) { } #endregion 构造函数 #region 初始化组件 private void InitializeComponent() { this.radioButton_DarkGray = new System.Windows.Forms.RadioButton(); this.radioButton_Gray = new System.Windows.Forms.RadioButton(); this.radioButton_LightBlue = new System.Windows.Forms.RadioButton(); this.radioButton_Black = new System.Windows.Forms.RadioButton(); this.panel_displaySetting_A = new System.Windows.Forms.Panel(); this.panel_displaySetting_C = new System.Windows.Forms.Panel(); this.label_displaySetting_D = new System.Windows.Forms.Button(); this.panel_displaySetting_B = new System.Windows.Forms.Panel(); this.panel_displaySetting_D = new System.Windows.Forms.Panel(); this.label_displaySetting_C = new System.Windows.Forms.Button(); this.label_displaySetting_A = new System.Windows.Forms.Button(); this.label_displaySetting_B = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit(); this.groupBox_colorSetting.SuspendLayout(); this.groupBox_displaySetting.SuspendLayout(); this.SuspendLayout(); // // numericUpDown_lwRatioLimit // this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] { 2, 0, 0, 0}); // // groupBox_colorSetting // this.groupBox_colorSetting.Controls.Add(this.radioButton_DarkGray); this.groupBox_colorSetting.Controls.Add(this.radioButton_Gray); this.groupBox_colorSetting.Controls.Add(this.radioButton_LightBlue); this.groupBox_colorSetting.Controls.Add(this.radioButton_Black); this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Black, 0); this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_LightBlue, 0); this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_Gray, 0); this.groupBox_colorSetting.Controls.SetChildIndex(this.radioButton_DarkGray, 0); // // groupBox_displaySetting // this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_A); this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_C); this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_D); this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_B); this.groupBox_displaySetting.Controls.Add(this.panel_displaySetting_D); this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_C); this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_A); this.groupBox_displaySetting.Controls.Add(this.label_displaySetting_B); // // radioButton_DarkGray // this.radioButton_DarkGray.AutoSize = true; this.radioButton_DarkGray.Location = new System.Drawing.Point(178, 20); this.radioButton_DarkGray.Name = "radioButton_DarkGray"; this.radioButton_DarkGray.Size = new System.Drawing.Size(59, 16); this.radioButton_DarkGray.TabIndex = 38; this.radioButton_DarkGray.TabStop = true; this.radioButton_DarkGray.Text = PdnResources.GetString("Menu.Darkgray.text"); this.radioButton_DarkGray.UseVisualStyleBackColor = true; // // radioButton_Gray // this.radioButton_Gray.AutoSize = true; this.radioButton_Gray.Location = new System.Drawing.Point(125, 20); this.radioButton_Gray.Name = "radioButton_Gray"; this.radioButton_Gray.Size = new System.Drawing.Size(47, 16); this.radioButton_Gray.TabIndex = 37; this.radioButton_Gray.TabStop = true; this.radioButton_Gray.Text = PdnResources.GetString("Menu.gray.text"); this.radioButton_Gray.UseVisualStyleBackColor = true; // // radioButton_LightBlue // this.radioButton_LightBlue.AutoSize = true; this.radioButton_LightBlue.Location = new System.Drawing.Point(60, 20); this.radioButton_LightBlue.Name = "radioButton_LightBlue"; this.radioButton_LightBlue.Size = new System.Drawing.Size(59, 16); this.radioButton_LightBlue.TabIndex = 36; this.radioButton_LightBlue.TabStop = true; this.radioButton_LightBlue.Text = PdnResources.GetString("Menu.Bluish.text"); this.radioButton_LightBlue.UseVisualStyleBackColor = true; // // radioButton_Black // this.radioButton_Black.AutoSize = true; this.radioButton_Black.Location = new System.Drawing.Point(7, 20); this.radioButton_Black.Name = "radioButton_Black"; this.radioButton_Black.Size = new System.Drawing.Size(47, 16); this.radioButton_Black.TabIndex = 35; this.radioButton_Black.TabStop = true; this.radioButton_Black.Text = PdnResources.GetString("Menu.black.text"); this.radioButton_Black.UseVisualStyleBackColor = true; // // panel_displaySetting_A // this.panel_displaySetting_A.Location = new System.Drawing.Point(40, 25); this.panel_displaySetting_A.Name = "panel_displaySetting_A"; this.panel_displaySetting_A.Size = new System.Drawing.Size(21, 21); this.panel_displaySetting_A.TabIndex = 34; // // panel_displaySetting_C // this.panel_displaySetting_C.BackColor = System.Drawing.SystemColors.Control; this.panel_displaySetting_C.Location = new System.Drawing.Point(146, 25); this.panel_displaySetting_C.Name = "panel_displaySetting_C"; this.panel_displaySetting_C.Size = new System.Drawing.Size(21, 21); this.panel_displaySetting_C.TabIndex = 35; // // label_displaySetting_D // this.label_displaySetting_D.AutoSize = true; this.label_displaySetting_D.Location = new System.Drawing.Point(173, 25); this.label_displaySetting_D.Name = "label_displaySetting_D"; this.label_displaySetting_D.Size = new System.Drawing.Size(21, 22); this.label_displaySetting_D.TabIndex = 41; this.label_displaySetting_D.Text = "D"; // // panel_displaySetting_B // this.panel_displaySetting_B.BackColor = System.Drawing.SystemColors.Control; this.panel_displaySetting_B.Location = new System.Drawing.Point(92, 25); this.panel_displaySetting_B.Name = "panel_displaySetting_B"; this.panel_displaySetting_B.Size = new System.Drawing.Size(21, 21); this.panel_displaySetting_B.TabIndex = 33; // // panel_displaySetting_D // this.panel_displaySetting_D.BackColor = System.Drawing.SystemColors.Control; this.panel_displaySetting_D.Location = new System.Drawing.Point(200, 25); this.panel_displaySetting_D.Name = "panel_displaySetting_D"; this.panel_displaySetting_D.Size = new System.Drawing.Size(21, 21); this.panel_displaySetting_D.TabIndex = 36; // // label_displaySetting_C // this.label_displaySetting_C.AutoSize = true; this.label_displaySetting_C.Location = new System.Drawing.Point(119, 25); this.label_displaySetting_C.Name = "label_displaySetting_C"; this.label_displaySetting_C.Size = new System.Drawing.Size(21, 22); this.label_displaySetting_C.TabIndex = 40; this.label_displaySetting_C.Text = "C"; // // label_displaySetting_A // this.label_displaySetting_A.AutoSize = true; this.label_displaySetting_A.Location = new System.Drawing.Point(13, 25); this.label_displaySetting_A.Name = "label_displaySetting_A"; this.label_displaySetting_A.Size = new System.Drawing.Size(21, 22); this.label_displaySetting_A.TabIndex = 38; this.label_displaySetting_A.Text = "A"; // // label_displaySetting_B // this.label_displaySetting_B.AutoSize = true; this.label_displaySetting_B.Location = new System.Drawing.Point(67, 25); this.label_displaySetting_B.Name = "label_displaySetting_B"; this.label_displaySetting_B.Size = new System.Drawing.Size(21, 22); this.label_displaySetting_B.TabIndex = 39; this.label_displaySetting_B.Text = "B"; // // MethodDDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.ClientSize = new System.Drawing.Size(1177, 908); this.Name = "MethodDDialog"; this.Text = "ASTME45_MethodD("+ PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text")+ ")"; ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit(); this.groupBox_colorSetting.ResumeLayout(false); this.groupBox_colorSetting.PerformLayout(); this.groupBox_displaySetting.ResumeLayout(false); this.groupBox_displaySetting.PerformLayout(); this.ResumeLayout(false); } #endregion 初始化组件 #region 需继承方法 protected override void SubclassInitialize() { InitializeComponent(); this.radioButton_Black.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"]; } protected override MethodOfAssessment getMethodOfAssessment() { return new MethodD(this.imgPxPerUnit); } protected override void initColorSetting() { this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton); } protected override void initDisplaySetting() { this.panel_displaySetting_A.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["A"].showColor); this.panel_displaySetting_B.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["B"].showColor); this.panel_displaySetting_C.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["C"].showColor); this.panel_displaySetting_D.BackColor = Color.FromArgb(MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.typeDics["D"].showColor); } protected override void getInclusionParameters() { switch (whichChecked) { case 0: radioButton_Black.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"]; break; case 1: radioButton_Black.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Black"]; break; case 2: radioButton_LightBlue.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["LightBlue"]; break; case 3: radioButton_Gray.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["Gray"]; break; case 4: radioButton_DarkGray.Checked = true; this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions["DarkGray"]; break; } } protected override void saveInclusionParameters() { if (radioButton_Black.Checked) { thisParameters.parameter3 = 1; } else if (radioButton_LightBlue.Checked) { thisParameters.parameter3 = 2; } else if (radioButton_Gray.Checked) { thisParameters.parameter3 = 3; } else if (radioButton_DarkGray.Checked) { thisParameters.parameter3 = 4; } } protected override void getOldCheck() { this.radioButton_Black.CheckedChanged -= new System.EventHandler(colorSettingRadioButton); this.radioButton_Gray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton); this.radioButton_LightBlue.CheckedChanged -= new System.EventHandler(colorSettingRadioButton); this.radioButton_DarkGray.CheckedChanged -= new System.EventHandler(colorSettingRadioButton); switch (colorName) { case "Black": radioButton_Black.Checked = true; break; case "Gray": radioButton_Gray.Checked = true; break; case "DarkGray": radioButton_DarkGray.Checked = true; break; case "LightBlue": radioButton_LightBlue.Checked = true; break; } this.radioButton_Black.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_Gray.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_LightBlue.CheckedChanged += new System.EventHandler(colorSettingRadioButton); this.radioButton_DarkGray.CheckedChanged += new System.EventHandler(colorSettingRadioButton); } #endregion 需继承方法 } }