using PaintDotNet; 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.ImageLabel { public partial class LabelListChangeName : PdnBaseForm { private TextBox textBox1; private Button button1; private Label label1; // 创建委托 public delegate void TransferDataDelegate(string name); // 声明一个事件(本质是一个委托) public event TransferDataDelegate TransferEvent; public LabelListChangeName() { this.StartPosition = FormStartPosition.CenterParent; InitializeComponent(); } private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(31, 60); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(41, 12); this.label1.TabIndex = 0; this.label1.Text = "名称:"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(78, 57); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(202, 21); this.textBox1.TabIndex = 1; // // button1 // this.button1.Location = new System.Drawing.Point(124, 99); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 2; this.button1.Text = "确定"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // LabelListChangeName // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.ClientSize = new System.Drawing.Size(323, 134); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Controls.Add(this.label1); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "LabelListChangeName"; this.Text = "标注信息"; this.Controls.SetChildIndex(this.label1, 0); this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.button1, 0); this.ResumeLayout(false); this.PerformLayout(); } /// /// 确定 /// /// /// private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) MessageBox.Show("名称不能為空"); else { TransferEvent(textBox1.Text); this.Close();// 关闭窗体 } } } }