8.3.txt

来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 37 行

TXT
37
字号
Listing 8.3 Associating Events with an Event Handler Using the Multicast Delegate
Syntax
private void InitializeComponent()
{
this.sayHello = new System.Windows.Forms.Button();
this.closeForm = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// sayHello
//
this.sayHello.Location = new System.Drawing.Point(98, 16);
this.sayHello.Name = “sayHello”;
this.sayHello.Size = new System.Drawing.Size(96, 23);
this.sayHello.TabIndex = 0;
this.sayHello.Text = “Say Hello”;
// event handler association for the Click event
this.sayHello.Click += new System.EventHandler(this.sayHello_Click);
//
// closeForm
//
this.closeForm.Location = new System.Drawing.Point(98, 64);
this.closeForm.Name = “closeForm”;
this.closeForm.Size = new System.Drawing.Size(96, 23);
this.closeForm.TabIndex = 1;
this.closeForm.Text = “Close Form”;
this.closeForm.Click += new System.EventHandler(this.closeForm_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 118);
this.Controls.Add(this.closeForm);
this.Controls.Add(this.sayHello);
this.Name = “Form1”;
this.Text = “Form1”;
this.ResumeLayout(false);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?