winfrom下调用button的click()事件 调用button的click事件时。this.button1.perpform()与this.button1_click(this,null)有何不同? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 EventArgs 一个实力了 一个为NULL this.button3.PerformClick(); this.button3_Click(this, null);我是指这两个方法有何不同!!! 你有没有亲自试过这两个方法??如果真是一样的我还来这里问什么?别不服气,给你段代码,自己回去好好试试.看看是不是一样的!using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsApplication3{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } int i = 0; private void button1_Click(object sender, EventArgs e) { MessageBox.Show("点击了Button而显示消息"); } private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Visible = false; this.notifyIcon1.Visible = true; } } private void notifyIcon1_Click(object sender, EventArgs e) { this.notifyIcon1.Visible = false; this.Visible = true; this.WindowState = FormWindowState.Normal; this.timer1.Stop(); this.timer2.Stop(); } private void timer1_Tick(object sender, EventArgs e) { this.button1_Click(this, null); timer1.Stop(); } private void timer2_Tick(object sender, EventArgs e) { this.button1.PerformClick(); } private void button2_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; this.timer1.Start(); } private void button3_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; this.timer2.Start(); } }} this.button3_Click(this, null); 直接调用.this.button3.PerformClick(); 通过产生button3的Click事件来调用.如果执行了this.button3.Click-=new EventHandler(button3_Click); //取消button3的click事件.后.执行this.button3.PerformClick(); 则不会执行this.button3_Click(...); 也就是是说button_Click()方法,直接执行的是方法内的代码.而button_performClick()是调用的Event事件.可以这么理解吧? 想跳用click()里面执行的代码啊,这两种写法都是很春的。 为什么我查询yahoo、baidu的whois信息,查询不到? 请问那里可以下载LowerCaseTokenizer,WhitespaceTokenizer 取9个随机数步重复数组会死循环. 请教各位,用c#开发大家都是用的什么建模软件。 C# 怎么读取数据库里的2进制文件 问一个很怪的问题 求net 动态链接库与代码反编译可网银转账 如何实现自动拨号和断号 C# 加密 大神 有木有 ?! 图标文件.ICO 如何转化成.BMP ? gridview里FooterRow 的问题 Webbrowser控件加载框架网页,如何改变一个方法的返回值
this.button3_Click(this, null);我是指这两个方法有何不同!!!
别不服气,给你段代码,自己回去好好试试.看看是不是一样的!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("点击了Button而显示消息"); } private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = false;
this.notifyIcon1.Visible = true;
}
} private void notifyIcon1_Click(object sender, EventArgs e)
{
this.notifyIcon1.Visible = false;
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.timer1.Stop();
this.timer2.Stop();
} private void timer1_Tick(object sender, EventArgs e)
{
this.button1_Click(this, null);
timer1.Stop();
} private void timer2_Tick(object sender, EventArgs e)
{
this.button1.PerformClick();
} private void button2_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.timer1.Start();
} private void button3_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.timer2.Start();
}
}
}
直接调用.this.button3.PerformClick();
通过产生button3的Click事件来调用.
如果执行了this.button3.Click-=new EventHandler(button3_Click); //取消button3的click事件.
后.
执行this.button3.PerformClick(); 则不会执行this.button3_Click(...);
而button_performClick()是调用的Event事件.可以这么理解吧?