public Form1()
{
InitializeComponent(); foreach (Control control in this.Controls)
{
control.Click += new EventHandler(control_Click);
}
}
private void InitializeComponent()
{
....
this.button1.Click += new System.EventHandler(this.button1_Click);
}
void control_Click(object sender, EventArgs e)
{
MessageBox.Show("aaaaa");
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("bbbb");
}怎样实现先提示aaaa, 然后再出现bbbb.
{
InitializeComponent(); foreach (Control control in this.Controls)
{
control.Click += new EventHandler(control_Click);
}
}
private void InitializeComponent()
{
....
this.button1.Click += new System.EventHandler(this.button1_Click);
}
void control_Click(object sender, EventArgs e)
{
MessageBox.Show("aaaaa");
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("bbbb");
}怎样实现先提示aaaa, 然后再出现bbbb.
解决方案 »
- foreach使用,求帮助
- 急:关于C#数据封送问题。。。。。。。求高人解答
- excel中的图片复制到剪切板之后处理
- 关于在WinForm里传递变量的问题
- 散分....
- XenoCode 2005混淆的dll控件在添加到VS.NET2003时出现错误
- 相册滑动。。。来看看吧 ·~
- 如何比较两个ArrayList的值是否相等?
- 如何改写BAT文件的内容?(清除BAT的内容后重新写入)
- c# 中在Windows服务内怎么调用WndProc(ref Message m)检测U盘插入信息?
- html image标签的问题 如何获得image标签提交的x,y值
- 关于安装文件msi文件的生成 世界未解之谜3!!!
{
MessageBox.Show("bbbb"); }
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("aaaaa");
}
不用怎么实现,你的btn是点了后才弹出提示框,而control也是点了后才弹出提示框,不存在谁先谁后,只有点了才触发
{
public Form1()
{
InitializeComponent(); foreach (Control ctrl in this.Controls)
{ PropertyInfo propertyInfo = ctrl.GetType().GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance);
EventHandlerList handlerList = (EventHandlerList)propertyInfo.GetValue(ctrl, null); FieldInfo field = typeof(Control).GetField("EventClick", BindingFlags.NonPublic| BindingFlags.Static);
Delegate d = handlerList[field.GetValue(null)];
ctrl.Click -= (EventHandler)d; d=Delegate.Combine(new EventHandler(this.ctrl_Click),d);
ctrl.Click += (EventHandler)d;
}
} void ctrl_Click(object sender, EventArgs e)
{
MessageBox.Show("aaaaa");
} private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("bbbb");
}
}