| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Model;
- 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 Metis.DedicatedAnalysis.Inclusions.New_DIN50602_1985
- {
- public partial class MethodSettingDialog : Form
- {
- private Button button2;
- private Button button1;
- private GroupBox groupBox2;
- private Label label4;
- private Label label3;
- private Label label2;
- private Label label1;
- private NumericUpDown numericUpDown1;
- private NumericUpDown numericUpDown2;
- private NumericUpDown numericUpDown3;
- private NumericUpDown numericUpDown4;
- private GroupBox groupBox1;
- // 创建委托
- public delegate void TransferDataDelegate(InclusionSetting inclusionSetting);
- // 声明一个事件(本质是一个委托)
- public event TransferDataDelegate TransferEvent;
- private InclusionSetting inclusionSetting;
- public MethodSettingDialog(InclusionSetting inclusionSetting)
- {
- this.inclusionSetting = inclusionSetting;
- InitializeComponent();
- numericUpDown1.Value = Convert.ToInt32(this.inclusionSetting.minLength);
- numericUpDown2.Value = Convert.ToInt32(this.inclusionSetting.minWidth);
- numericUpDown3.Value = Convert.ToDecimal(this.inclusionSetting.aspectRatio);
- numericUpDown4.Value = Convert.ToInt32(this.inclusionSetting.kNum);
- }
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(7, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(390, 50);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(309, 14);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "取消";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(228, 14);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "确定";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.numericUpDown4);
- this.groupBox2.Controls.Add(this.numericUpDown3);
- this.groupBox2.Controls.Add(this.numericUpDown2);
- this.groupBox2.Controls.Add(this.numericUpDown1);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.label2);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Location = new System.Drawing.Point(7, 68);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(390, 149);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "参数设置";
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(274, 88);
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(90, 21);
- this.numericUpDown4.TabIndex = 7;
- //
- // numericUpDown3
- //
- this.numericUpDown3.DecimalPlaces = 1;
- this.numericUpDown3.Increment = new decimal(new int[] {
- 1,
- 0,
- 0,
- 65536});
- this.numericUpDown3.Location = new System.Drawing.Point(97, 88);
- this.numericUpDown3.Name = "numericUpDown3";
- this.numericUpDown3.Size = new System.Drawing.Size(90, 21);
- this.numericUpDown3.TabIndex = 6;
- //
- // numericUpDown2
- //
- this.numericUpDown2.Location = new System.Drawing.Point(274, 28);
- this.numericUpDown2.Name = "numericUpDown2";
- this.numericUpDown2.Size = new System.Drawing.Size(90, 21);
- this.numericUpDown2.TabIndex = 5;
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(97, 28);
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(90, 21);
- this.numericUpDown1.TabIndex = 4;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(245, 90);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(23, 12);
- this.label4.TabIndex = 3;
- this.label4.Text = "K:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(206, 30);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(65, 12);
- this.label3.TabIndex = 2;
- this.label3.Text = "最小宽度:";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(26, 90);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(53, 12);
- this.label2.TabIndex = 1;
- this.label2.Text = "长度比:";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(26, 30);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(65, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "最小长度:";
- //
- // MethodSettingDialog
- //
- this.ClientSize = new System.Drawing.Size(405, 225);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "MethodSettingDialog";
- this.Text = "参数设置";
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- this.inclusionSetting.minLength = Convert.ToDouble(numericUpDown1.Value);
- this.inclusionSetting.minWidth = Convert.ToDouble(numericUpDown2.Value);
- this.inclusionSetting.aspectRatio = Convert.ToDouble(numericUpDown3.Value);
- this.inclusionSetting.kNum = Convert.ToInt32(numericUpDown4.Value);
- TransferEvent(this.inclusionSetting);
- this.Close();
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
|