using Metis.DedicatedAnalysis.Porosity.Model; using PaintDotNet; using PaintDotNet.Annotation; using PaintDotNet.Annotation.Enum; using PaintDotNet.Base.CommTool; using PaintDotNet.Base.DedicatedAnalysis.Porosity; using PaintDotNet.DedicatedAnalysis.Porosity; using PaintDotNet.DedicatedAnalysis.Porosity.PV6093; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Metis.DedicatedAnalysis.Porosity { internal class PorosityViewSetting : PdnBaseForm { private GroupBox groupBox_operating; private Button button2; private Button button1; private GroupBox groupBox_img; protected ListBox lstView_img; private GroupBox groupBox1; private Label label_showBinaryColor; private Panel panel_showBinaryColor; private GroupBox groupBox6; private NumericUpDown numericUpDown4; private NumericUpDown numericUpDown3; private Label label5; private Label label6; private GroupBox groupBox4; private NumericUpDown numericUpDown6; private NumericUpDown numericUpDown5; private RadioButton radioButton2; private RadioButton radioButton1; private Label label4; private Label label3; private GroupBox groupBox3; private Panel panel5; private Panel panel6; private Panel panel4; private Panel panel3; private Panel panel2; private Panel panel1; private Panel panel9; private Panel panel8; private Panel panel7; private Panel panel11; private Panel panel10; private Panel panel12; private Button btn_saveresult; private viewSetting ViewSetting; private int chooseIndex; private List drawObjectList; private List nameList; private ColorsForm lineColorsFormGrid; private ColorsForm viewColorsFormGrid; private int cilckNum; private PorosityStandardDialog pform; private double pxPerUnit; /// /// 旧中心点X坐标值 /// private int numericUpDown3Old; /// /// 旧中心点Y坐标值 /// private int numericUpDown4Old; private Label label1; /// /// 是否是保存 1 否 2 是 /// private int notSave = 1; public PorosityViewSetting(List drawObjectList, List nameList, int chooseIndex, viewSetting ViewSetting, PorosityStandardDialog porositysStandard, double pxPerUnit) { this.chooseIndex = chooseIndex; this.drawObjectList = drawObjectList; this.nameList = nameList; this.pxPerUnit = pxPerUnit; this.lineColorsFormGrid = new ColorsForm(); this.lineColorsFormGrid.StartPosition = FormStartPosition.CenterScreen; this.viewColorsFormGrid = new ColorsForm(); this.viewColorsFormGrid.StartPosition = FormStartPosition.CenterScreen; this.pform = porositysStandard; this.ViewSetting = ViewSetting; InitializeComponent(); InitializeLanguageText(); setData(); foreach (var s in this.nameList) { this.lstView_img.Items.Add(s); } this.lstView_img.SelectedIndex = chooseIndex; //this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange); //this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange); //this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange); //this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PorosityViewSettingClosing); } private void InitializeLanguageText() { this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text"); this.button2.Text = PdnResources.GetString("Menu.ViewSetting.DeleteFieldOfView.Text"); this.button1.Text = PdnResources.GetString("Menu.Theemptyview.Text"); this.btn_saveresult.Text = PdnResources.GetString("Menu.Savethechanges.Text"); this.groupBox_img.Text = PdnResources.GetString("Menu.Fieldofviewlisthasbeenadded.Text"); this.groupBox1.Text = PdnResources.GetString("Menu.Theviewattribute.Text"); this.groupBox6.Text = PdnResources.GetString("Menu.position.text"); this.label5.Text = PdnResources.GetString("Menu.viewsetting.Modifyview.Centerpoint.text") + "Y"; this.label6.Text = PdnResources.GetString("Menu.viewsetting.Modifyview.Centerpoint.text") + "X"; this.groupBox4.Text = PdnResources.GetString("Menu.Edit.ActualSize.Text"); this.radioButton2.Text = PdnResources.GetString("Menu.area.text"); this.radioButton1.Text = PdnResources.GetString("Menu.diameter.text"); this.groupBox3.Text = PdnResources.GetString("Menu.DefaultcolorSettings.Text"); this.label1.Text = PdnResources.GetString("Menu.color.text"); this.Text = PdnResources.GetString("Menu.ViewSetting.Text"); } private void InitializeComponent() { this.groupBox_operating = new System.Windows.Forms.GroupBox(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.btn_saveresult = new System.Windows.Forms.Button(); this.groupBox_img = new System.Windows.Forms.GroupBox(); this.lstView_img = new System.Windows.Forms.ListBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.numericUpDown6 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown5 = new System.Windows.Forms.NumericUpDown(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.panel_showBinaryColor = new System.Windows.Forms.Panel(); this.label_showBinaryColor = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.panel12 = new System.Windows.Forms.Panel(); this.panel11 = new System.Windows.Forms.Panel(); this.panel10 = new System.Windows.Forms.Panel(); this.panel9 = new System.Windows.Forms.Panel(); this.panel8 = new System.Windows.Forms.Panel(); this.panel7 = new System.Windows.Forms.Panel(); this.panel5 = new System.Windows.Forms.Panel(); this.panel6 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.groupBox_operating.SuspendLayout(); this.groupBox_img.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // groupBox_operating // this.groupBox_operating.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox_operating.Controls.Add(this.button2); this.groupBox_operating.Controls.Add(this.button1); this.groupBox_operating.Controls.Add(this.btn_saveresult); this.groupBox_operating.Location = new System.Drawing.Point(12, 12); this.groupBox_operating.Name = "groupBox_operating"; this.groupBox_operating.Size = new System.Drawing.Size(579, 53); this.groupBox_operating.TabIndex = 13; this.groupBox_operating.TabStop = false; // // button2 // this.button2.Location = new System.Drawing.Point(383, 15); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 4; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // button1 // this.button1.Location = new System.Drawing.Point(293, 15); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 3; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // btn_saveresult // this.btn_saveresult.Location = new System.Drawing.Point(472, 15); this.btn_saveresult.Name = "btn_saveresult"; this.btn_saveresult.Size = new System.Drawing.Size(75, 23); this.btn_saveresult.TabIndex = 2; this.btn_saveresult.UseVisualStyleBackColor = true; this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click); // // groupBox_img // this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox_img.Controls.Add(this.lstView_img); this.groupBox_img.Location = new System.Drawing.Point(12, 72); this.groupBox_img.Margin = new System.Windows.Forms.Padding(4); this.groupBox_img.Name = "groupBox_img"; this.groupBox_img.Padding = new System.Windows.Forms.Padding(4); this.groupBox_img.Size = new System.Drawing.Size(158, 259); this.groupBox_img.TabIndex = 14; this.groupBox_img.TabStop = false; // // lstView_img // this.lstView_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lstView_img.ItemHeight = 12; this.lstView_img.Location = new System.Drawing.Point(8, 26); this.lstView_img.Margin = new System.Windows.Forms.Padding(4); this.lstView_img.Name = "lstView_img"; this.lstView_img.Size = new System.Drawing.Size(140, 220); this.lstView_img.TabIndex = 0; this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.groupBox6); this.groupBox1.Controls.Add(this.groupBox4); this.groupBox1.Controls.Add(this.panel_showBinaryColor); this.groupBox1.Controls.Add(this.label_showBinaryColor); this.groupBox1.Location = new System.Drawing.Point(177, 72); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(414, 259); this.groupBox1.TabIndex = 36; this.groupBox1.TabStop = false; // // groupBox6 // this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox6.Controls.Add(this.numericUpDown4); this.groupBox6.Controls.Add(this.numericUpDown3); this.groupBox6.Controls.Add(this.label5); this.groupBox6.Controls.Add(this.label6); this.groupBox6.Location = new System.Drawing.Point(15, 168); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(385, 47); this.groupBox6.TabIndex = 42; this.groupBox6.TabStop = false; // // numericUpDown4 // this.numericUpDown4.Location = new System.Drawing.Point(269, 15); this.numericUpDown4.Maximum = new decimal(new int[] { 2147483646, 0, 0, 0}); this.numericUpDown4.Name = "numericUpDown4"; this.numericUpDown4.Size = new System.Drawing.Size(95, 21); this.numericUpDown4.TabIndex = 12; // // numericUpDown3 // this.numericUpDown3.Location = new System.Drawing.Point(77, 15); this.numericUpDown3.Maximum = new decimal(new int[] { 2147483646, 0, 0, 0}); this.numericUpDown3.Name = "numericUpDown3"; this.numericUpDown3.Size = new System.Drawing.Size(98, 21); this.numericUpDown3.TabIndex = 11; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(200, 19); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(47, 12); this.label5.TabIndex = 11; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(11, 19); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(47, 12); this.label6.TabIndex = 9; // // groupBox4 // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox4.Controls.Add(this.numericUpDown6); this.groupBox4.Controls.Add(this.numericUpDown5); this.groupBox4.Controls.Add(this.radioButton2); this.groupBox4.Controls.Add(this.radioButton1); this.groupBox4.Controls.Add(this.label4); this.groupBox4.Controls.Add(this.label3); this.groupBox4.Location = new System.Drawing.Point(16, 85); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(383, 53); this.groupBox4.TabIndex = 41; this.groupBox4.TabStop = false; // // numericUpDown6 // this.numericUpDown6.DecimalPlaces = 10; this.numericUpDown6.Location = new System.Drawing.Point(268, 16); this.numericUpDown6.Maximum = new decimal(new int[] { 214748364, 0, 0, 0}); this.numericUpDown6.Minimum = new decimal(new int[] { 214748364, 0, 0, -2147483648}); this.numericUpDown6.Name = "numericUpDown6"; this.numericUpDown6.Size = new System.Drawing.Size(98, 21); this.numericUpDown6.TabIndex = 14; // // numericUpDown5 // this.numericUpDown5.DecimalPlaces = 10; this.numericUpDown5.Location = new System.Drawing.Point(76, 16); this.numericUpDown5.Maximum = new decimal(new int[] { 214748364, 0, 0, 0}); this.numericUpDown5.Minimum = new decimal(new int[] { 214748364, 0, 0, -2147483648}); this.numericUpDown5.Name = "numericUpDown5"; this.numericUpDown5.Size = new System.Drawing.Size(99, 21); this.numericUpDown5.TabIndex = 13; // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(202, 16); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(47, 16); this.radioButton2.TabIndex = 12; this.radioButton2.TabStop = true; this.radioButton2.UseVisualStyleBackColor = true; // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Location = new System.Drawing.Point(11, 18); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(47, 16); this.radioButton1.TabIndex = 11; this.radioButton1.TabStop = true; this.radioButton1.UseVisualStyleBackColor = true; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(236, 22); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(0, 12); this.label4.TabIndex = 7; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(11, 22); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(0, 12); this.label3.TabIndex = 0; // // panel_showBinaryColor // this.panel_showBinaryColor.BackColor = System.Drawing.Color.Yellow; this.panel_showBinaryColor.Location = new System.Drawing.Point(62, 27); this.panel_showBinaryColor.Name = "panel_showBinaryColor"; this.panel_showBinaryColor.Size = new System.Drawing.Size(76, 22); this.panel_showBinaryColor.TabIndex = 40; this.panel_showBinaryColor.Click += new System.EventHandler(this.panel_showBinaryColor_Click); // // label_showBinaryColor // this.label_showBinaryColor.AutoSize = true; this.label_showBinaryColor.Location = new System.Drawing.Point(14, 37); this.label_showBinaryColor.Name = "label_showBinaryColor"; this.label_showBinaryColor.Size = new System.Drawing.Size(0, 12); this.label_showBinaryColor.TabIndex = 39; // // groupBox3 // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.panel12); this.groupBox3.Controls.Add(this.panel11); this.groupBox3.Controls.Add(this.panel10); this.groupBox3.Controls.Add(this.panel9); this.groupBox3.Controls.Add(this.panel8); this.groupBox3.Controls.Add(this.panel7); this.groupBox3.Controls.Add(this.panel5); this.groupBox3.Controls.Add(this.panel6); this.groupBox3.Controls.Add(this.panel4); this.groupBox3.Controls.Add(this.panel3); this.groupBox3.Controls.Add(this.panel2); this.groupBox3.Controls.Add(this.panel1); this.groupBox3.Location = new System.Drawing.Point(11, 338); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(579, 106); this.groupBox3.TabIndex = 37; this.groupBox3.TabStop = false; // // panel12 // this.panel12.BackColor = System.Drawing.Color.Yellow; this.panel12.Location = new System.Drawing.Point(489, 57); this.panel12.Name = "panel12"; this.panel12.Size = new System.Drawing.Size(76, 22); this.panel12.TabIndex = 48; this.panel12.Click += new System.EventHandler(this.panel12_Click); // // panel11 // this.panel11.BackColor = System.Drawing.Color.Yellow; this.panel11.Location = new System.Drawing.Point(395, 57); this.panel11.Name = "panel11"; this.panel11.Size = new System.Drawing.Size(76, 22); this.panel11.TabIndex = 47; this.panel11.Click += new System.EventHandler(this.panel11_Click); // // panel10 // this.panel10.BackColor = System.Drawing.Color.Yellow; this.panel10.Location = new System.Drawing.Point(304, 57); this.panel10.Name = "panel10"; this.panel10.Size = new System.Drawing.Size(76, 22); this.panel10.TabIndex = 46; this.panel10.Click += new System.EventHandler(this.panel10_Click); // // panel9 // this.panel9.BackColor = System.Drawing.Color.Yellow; this.panel9.Location = new System.Drawing.Point(212, 57); this.panel9.Name = "panel9"; this.panel9.Size = new System.Drawing.Size(76, 22); this.panel9.TabIndex = 45; this.panel9.Click += new System.EventHandler(this.panel9_Click); // // panel8 // this.panel8.BackColor = System.Drawing.Color.Yellow; this.panel8.Location = new System.Drawing.Point(114, 57); this.panel8.Name = "panel8"; this.panel8.Size = new System.Drawing.Size(76, 22); this.panel8.TabIndex = 44; this.panel8.Click += new System.EventHandler(this.panel8_Click); // // panel7 // this.panel7.BackColor = System.Drawing.Color.Yellow; this.panel7.Location = new System.Drawing.Point(16, 57); this.panel7.Name = "panel7"; this.panel7.Size = new System.Drawing.Size(76, 22); this.panel7.TabIndex = 43; this.panel7.Click += new System.EventHandler(this.panel7_Click); // // panel5 // this.panel5.BackColor = System.Drawing.Color.Yellow; this.panel5.Location = new System.Drawing.Point(395, 20); this.panel5.Name = "panel5"; this.panel5.Size = new System.Drawing.Size(76, 22); this.panel5.TabIndex = 42; this.panel5.Click += new System.EventHandler(this.panel5_Click); // // panel6 // this.panel6.BackColor = System.Drawing.Color.Yellow; this.panel6.Location = new System.Drawing.Point(489, 20); this.panel6.Name = "panel6"; this.panel6.Size = new System.Drawing.Size(76, 22); this.panel6.TabIndex = 42; this.panel6.Click += new System.EventHandler(this.panel6_Click); // // panel4 // this.panel4.BackColor = System.Drawing.Color.Yellow; this.panel4.Location = new System.Drawing.Point(304, 20); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(76, 22); this.panel4.TabIndex = 42; this.panel4.Click += new System.EventHandler(this.panel4_Click); // // panel3 // this.panel3.BackColor = System.Drawing.Color.Yellow; this.panel3.Location = new System.Drawing.Point(212, 20); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(76, 22); this.panel3.TabIndex = 42; this.panel3.Click += new System.EventHandler(this.panel3_Click); // // panel2 // this.panel2.BackColor = System.Drawing.Color.Yellow; this.panel2.Location = new System.Drawing.Point(114, 20); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(76, 22); this.panel2.TabIndex = 42; this.panel2.Click += new System.EventHandler(this.panel2_Click); // // panel1 // this.panel1.BackColor = System.Drawing.Color.Yellow; this.panel1.Location = new System.Drawing.Point(16, 20); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(76, 22); this.panel1.TabIndex = 41; this.panel1.Click += new System.EventHandler(this.panel1_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(15, 36); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(29, 12); this.label1.TabIndex = 43; // // PorosityViewSetting // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.ClientSize = new System.Drawing.Size(602, 452); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox_img); this.Controls.Add(this.groupBox_operating); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "PorosityViewSetting"; this.Controls.SetChildIndex(this.groupBox_operating, 0); this.Controls.SetChildIndex(this.groupBox_img, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox3, 0); this.groupBox_operating.ResumeLayout(false); this.groupBox_img.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox6.ResumeLayout(false); this.groupBox6.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit(); this.groupBox3.ResumeLayout(false); this.ResumeLayout(false); } #region [相关事件] private void setData() { panel1.BackColor = Color.FromArgb(ViewSetting.colorFirst); panel2.BackColor = Color.FromArgb(ViewSetting.colorSecond); panel3.BackColor = Color.FromArgb(ViewSetting.colorThird); panel4.BackColor = Color.FromArgb(ViewSetting.colorFourth); panel5.BackColor = Color.FromArgb(ViewSetting.colorFifth); panel6.BackColor = Color.FromArgb(ViewSetting.colorSixth); panel7.BackColor = Color.FromArgb(ViewSetting.colorSeventh); panel8.BackColor = Color.FromArgb(ViewSetting.colorEighth); panel9.BackColor = Color.FromArgb(ViewSetting.colorNinth); panel10.BackColor = Color.FromArgb(ViewSetting.colorTenth); panel11.BackColor = Color.FromArgb(ViewSetting.colorEleventh); panel12.BackColor = Color.FromArgb(ViewSetting.colorTwelfth); panel_showBinaryColor.BackColor = retrunColor(this.chooseIndex); } private Color retrunColor(int index) { switch ((index + 1) % 12) { case 1: return Color.FromArgb(ViewSetting.colorFirst); case 2: return Color.FromArgb(ViewSetting.colorSecond); case 3: return Color.FromArgb(ViewSetting.colorThird); case 4: return Color.FromArgb(ViewSetting.colorFourth); case 5: return Color.FromArgb(ViewSetting.colorFifth); case 6: return Color.FromArgb(ViewSetting.colorSixth); case 7: return Color.FromArgb(ViewSetting.colorSeventh); case 8: return Color.FromArgb(ViewSetting.colorEighth); case 9: return Color.FromArgb(ViewSetting.colorNinth); case 10: return Color.FromArgb(ViewSetting.colorTenth); case 11: return Color.FromArgb(ViewSetting.colorEleventh); case 12: return Color.FromArgb(ViewSetting.colorTwelfth); } return Color.FromArgb(ViewSetting.colorFirst); } private void lstView_img_SelectedIndexChanged(object sender, EventArgs e) { this.chooseIndex = this.lstView_img.SelectedIndex; this.pform.colorHighlight(chooseIndex); if (chooseIndex == -1) { panel_showBinaryColor.BackColor = Color.FromArgb(ViewSetting.colorFirst); return; } panel_showBinaryColor.BackColor = this.drawObjectList[this.chooseIndex].Color; var type = this.drawObjectList[this.chooseIndex].drawToolType; if (type == DrawToolType.ViewPolygon || type == DrawToolType.ViewTriangleEx || type == DrawToolType.ViewRectangleEx) { numericUpDown5.Enabled = false; numericUpDown6.Enabled = false; } else { numericUpDown5.Enabled = true; numericUpDown6.Enabled = true; } this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange); this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange); //this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit); //this.numericUpDown6.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit); switch (type) { case DrawToolType.ViewOval: this.radioButton1.Text = PdnResources.GetString("Menu.horizontalaxis.Text"); this.radioButton2.Text = PdnResources.GetString("Menu.verticalaxis.Text"); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit)); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit)); break; case DrawToolType.ViewCircle: this.radioButton1.Text = PdnResources.GetString("Menu.diameter.text"); this.radioButton2.Text = PdnResources.GetString("Menu.area.text"); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit)); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(Math.PI * this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * 0.25 * pxPerUnit * pxPerUnit)); break; case DrawToolType.ViewRectangle: this.radioButton2.Text = PdnResources.GetString("Menu.width.text"); this.radioButton1.Text = PdnResources.GetString("Menu.height.text"); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit)); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit)); break; case DrawToolType.ViewRectangleEx: this.radioButton2.Text = PdnResources.GetString("Menu.width.text"); this.radioButton1.Text = PdnResources.GetString("Menu.height.text"); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit)); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit)); break; case DrawToolType.ViewTriangle: this.radioButton1.Text = PdnResources.GetString("Menu.Horizontalsidelength.Text"); this.radioButton2.Text = PdnResources.GetString("Menu.Verticalsidelength.Text"); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit)); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit)); break; case DrawToolType.ViewSquare: this.radioButton1.Text = PdnResources.GetString("Menu.Generalanalysis.Processmparison.Sidelength.text"); this.radioButton2.Text = PdnResources.GetString("Menu.area.text"); this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit)); this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit)); break; case DrawToolType.ViewPolygon: case DrawToolType.ViewTriangleEx: this.numericUpDown5.Value = 0; this.numericUpDown6.Value = 0; break; } int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2)); int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2)); this.numericUpDown3.Value = Math.Abs(centerX); this.numericUpDown4.Value = Math.Abs(centerY); this.numericUpDown3Old = Math.Abs(centerX); this.numericUpDown4Old = Math.Abs(centerY); this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange); this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange); } /// /// 修改中心点x坐标的事件 /// /// /// private void numericUpDown3_ValueChange(object sender, EventArgs e) { if (this.lstView_img.SelectedIndex == -1) { return; } if (this.numericUpDown3Old != (int)this.numericUpDown3.Value) { var id = this.drawObjectList[this.chooseIndex].ID; this.pform.numericUpDown3_ValueChange(id, this.chooseIndex, (int)this.numericUpDown3.Value, this.numericUpDown3Old); this.numericUpDown3Old = (int)this.numericUpDown3.Value; } } /// /// 修改中心点y坐标的事件 /// /// /// private void numericUpDown4_ValueChange(object sender, EventArgs e) { if (this.lstView_img.SelectedIndex == -1) { return; } if (this.numericUpDown4Old != (int)this.numericUpDown4.Value) { var id = this.drawObjectList[this.chooseIndex].ID; this.pform.numericupdown4_valuechange(id, this.chooseIndex, (int)this.numericUpDown4.Value, this.numericUpDown4Old); this.numericUpDown4Old = (int)this.numericUpDown4.Value; } } /// /// /// /// /// private void numericUpDown5_ValueChange(object sender, EventArgs e) { if (this.lstView_img.SelectedIndex == -1) { return; } this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange); this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange); var id = this.drawObjectList[this.chooseIndex].ID; this.drawObjectList[this.chooseIndex] = this.pform.numericUpDown5_ValueChange(id, this.chooseIndex, (int)this.numericUpDown5.Value); int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2)); int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2)); this.numericUpDown3.Value = Math.Abs(centerX); this.numericUpDown4.Value = Math.Abs(centerY); this.numericUpDown3Old = Math.Abs(centerX); this.numericUpDown4Old = Math.Abs(centerY); var type = this.drawObjectList[this.chooseIndex].drawToolType; switch (type) { case DrawToolType.ViewCircle: this.numericUpDown6.Value = Convert.ToDecimal(Math.PI * this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * 0.25 * pxPerUnit * pxPerUnit); break; case DrawToolType.ViewSquare: this.numericUpDown6.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit); break; } this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange); this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange); } /// /// /// /// /// private void numericUpDown6_ValueChange(object sender, EventArgs e) { if (this.lstView_img.SelectedIndex == -1) { return; } this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange); var id = this.drawObjectList[this.chooseIndex].ID; this.drawObjectList[this.chooseIndex] = this.pform.numericUpDown6_ValueChange(id, this.chooseIndex, (int)this.numericUpDown6.Value); int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2)); int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2)); this.numericUpDown3.Value = Math.Abs(centerX); this.numericUpDown4.Value = Math.Abs(centerY); this.numericUpDown3Old = Math.Abs(centerX); this.numericUpDown4Old = Math.Abs(centerY); var type = this.drawObjectList[this.chooseIndex].drawToolType; switch (type) { case DrawToolType.ViewCircle: this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit); break; case DrawToolType.ViewSquare: this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit); break; } this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange); } private void panel_showBinaryColor_Click(object sender, EventArgs e) { this.lineColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel_showBinaryColor.BackColor); this.lineColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged)); this.lineColorsFormGrid.ShowDialog(); } private void lineColorChanged(object sender, EventArgs e) { if (this.chooseIndex == -1) { MessageBox.Show(PdnResources.GetString("Menu.eforechangingthecolor.Text")); return; } Color color = this.lineColorsFormGrid.UserPrimaryColor.ToColor(); //更改背景色,触发事件 this.panel_showBinaryColor.BackColor = color; this.pform.changeThisColor(this.chooseIndex, color.ToArgb()); //关闭色板 this.lineColorsFormGrid.Close(); } #region [底部修改视场颜色事件集合] private void panel1_Click(object sender, EventArgs e) { this.cilckNum = 1; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel2_Click(object sender, EventArgs e) { this.cilckNum = 2; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel3_Click(object sender, EventArgs e) { this.cilckNum = 3; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel4_Click(object sender, EventArgs e) { this.cilckNum = 4; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel5_Click(object sender, EventArgs e) { this.cilckNum = 5; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel6_Click(object sender, EventArgs e) { this.cilckNum = 6; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel7_Click(object sender, EventArgs e) { this.cilckNum = 7; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel7.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel8_Click(object sender, EventArgs e) { this.cilckNum = 8; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel8.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel9_Click(object sender, EventArgs e) { this.cilckNum = 9; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel9.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel10_Click(object sender, EventArgs e) { this.cilckNum = 10; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel10.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel11_Click(object sender, EventArgs e) { this.cilckNum = 11; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel11.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void panel12_Click(object sender, EventArgs e) { this.cilckNum = 12; this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel12.BackColor); this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged)); this.viewColorsFormGrid.ShowDialog(); } private void viewColorChanged(object sender, EventArgs e) { Color color = this.viewColorsFormGrid.UserPrimaryColor.ToColor(); if (this.cilckNum == 1) { ViewSetting.colorFirst = color.ToArgb(); panel1.BackColor = color; } else if (this.cilckNum == 2) { ViewSetting.colorSecond = color.ToArgb(); panel2.BackColor = color; } else if (this.cilckNum == 3) { ViewSetting.colorThird = color.ToArgb(); panel3.BackColor = color; } else if (this.cilckNum == 4) { ViewSetting.colorFourth = color.ToArgb(); panel4.BackColor = color; } else if (this.cilckNum == 5) { ViewSetting.colorFifth = color.ToArgb(); panel5.BackColor = color; } else if (this.cilckNum == 6) { ViewSetting.colorSixth = color.ToArgb(); panel6.BackColor = color; } else if (this.cilckNum == 7) { ViewSetting.colorSeventh = color.ToArgb(); panel7.BackColor = color; } else if (this.cilckNum == 8) { ViewSetting.colorEighth = color.ToArgb(); panel8.BackColor = color; } else if (this.cilckNum == 9) { ViewSetting.colorNinth = color.ToArgb(); panel9.BackColor = color; } else if (this.cilckNum == 10) { ViewSetting.colorTenth = color.ToArgb(); panel10.BackColor = color; } else if (this.cilckNum == 11) { ViewSetting.colorEleventh = color.ToArgb(); panel11.BackColor = color; } else if (this.cilckNum == 0) { ViewSetting.colorTwelfth = color.ToArgb(); panel12.BackColor = color; } //if ((this.chooseIndex + 1) % 12 == (this.cilckNum % 12)) { // this.panel_showBinaryColor.BackColor = color; //} this.viewColorsFormGrid.Close(); } #endregion private void button1_Click(object sender, EventArgs e) { this.lstView_img.Items.Clear(); this.pform.clearView(); MessageBox.Show(PdnResources.GetString("Menu.Clearedviewsuccessfully.Text")); this.Close(); } private void button2_Click(object sender, EventArgs e) { try { this.pform.clearOneView(this.drawObjectList[this.chooseIndex].ID, this.chooseIndex); this.lstView_img.Items.RemoveAt(this.chooseIndex); MessageBox.Show(PdnResources.GetString("Menu.Fieldofviewremovedsuccessfully.Text")); this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange); this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange); this.numericUpDown3.Value = 0; this.numericUpDown4.Value = 0; this.numericUpDown5.Value = 0; this.numericUpDown6.Value = 0; this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange); this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange); this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange); this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange); } catch (Exception ex) { MessageBox.Show(PdnResources.GetString("Menu.Deletinvifailelate.Text")); } } private void btn_saveresult_Click(object sender, EventArgs e) { if (this.lstView_img.SelectedIndex == -1) { MessageBox.Show("请先选择视场!"); this.numericUpDown3.Value = 0; this.numericUpDown4.Value = 0; this.numericUpDown5.Value = 0; this.numericUpDown6.Value = 0; return; } string ViewSettingStr = XmlSerializeHelper.XmlSerialize(this.ViewSetting); FileOperationHelper.WriteStringToFile(ViewSettingStr, Application.StartupPath + "\\PorosityConfig\\ViewConfig.xml", FileMode.Create); MessageBox.Show(PdnResources.GetString("Menu.Savemodificationsuccessfully.Text")); this.pform.editView(); this.notSave = 2; this.Close(); } private void PorosityViewSettingClosing(object sender, EventArgs e) { //取消高亮 this.pform.colorHighlight(-1); //判断是否是保存后关闭 if (this.notSave == 1) { this.pform.returnOldColor(); } } #endregion } }