自定义事件虚拟按钮
来源:互联网 发布:淘宝网高音板胡 编辑:程序博客网 时间:2024/06/03 02:05
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void Form_Click(object sender,EventArgs e)
{
MessageBox.Show("你点的窗体");
}
public void Form_Click1(object sender, EventArgs e)
{
MessageBox.Show("你点了我");
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("你点了按妞");
}
}
}
在窗体的下一个文件里可以添加前面定义好的事件
如
namespace WindowsFormsApplication3
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(89, 105);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click += new System.EventHandler(this.Form_Click1);
this.button1.Click += new System.EventHandler(this.Form_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void Form_Click(object sender,EventArgs e)
{
MessageBox.Show("你点的窗体");
}
public void Form_Click1(object sender, EventArgs e)
{
MessageBox.Show("你点了我");
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("你点了按妞");
}
}
}
在窗体的下一个文件里可以添加前面定义好的事件
如
namespace WindowsFormsApplication3
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(89, 105);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click += new System.EventHandler(this.Form_Click1);
this.button1.Click += new System.EventHandler(this.Form_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}
- 自定义事件虚拟按钮
- 自定义按钮点击事件
- 自定义按钮实现Android 返回按钮事件
- 自定义按钮实现android 返回按钮 事件
- ALV OO:单击事件-双击事件-自定义按钮事件(示例)
- JFace Wizard 自定义 “Next” 按钮事件
- VC给自定义按钮加上事件操作
- JFace Wizard 自定义 “Next” 按钮事件
- 自定义dialog响应按钮点击事件
- 自定义Dialog如何监听按钮事件
- 自定义Notification实现按钮点击事件
- 自定义Dialog以及按钮事件监听
- 自定义UITableViewCell 上按钮点击事件处理
- 自定义按钮捕获tabbarItem点击事件
- 自定义cell中的按钮点击事件
- 自定义Cell中按钮的点击事件
- 自定义导航栏返回按钮点击事件
- swift自定义导航控制器返回按钮事件
- 定GRIDVIEW的宽高
- 投票+发帖
- ASP.NET SESSION丢失问题解决方案
- ASP.NET中常用的优化性能方法
- 站点地图
- 自定义事件虚拟按钮
- 80后常说的60句话
- 自定义验证控件两层
- 用Forms认证无法显示图片
- 月亮网摘(2009.1.8)
- 在AIX 5L上配置与管理路由
- 利用ASP.NET框架创建网站登陆
- Internet Explorer 安全区域注册表项说明
- SQL存储图片