111,097
社区成员




//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 39);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
//this.button1.Click += new System.EventHandler(this.button1_Click);
//this.button1.DoubleClick += new System.EventHandler(this.button1_Click);
this.button1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.button1_Click);
在form1.cs里面:
private void button1_Click(object sender, MouseEventArgs e)
{
MessageBox.Show("double click");
}
发现这个函数不会被调用,调试也进不来。完全不能响应双击?
我没有添加其他任何的事件响应。谢谢![/quote]
晕...那就不清楚了 http://msdn.microsoft.com/zh-cn/library/system.windows.forms.control.mousedoubleclick(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
MSDN上写是有的,而且也没写什么条件啊
实在不行可以用picturebox做一个
// 摘要:
// 当用户双击 System.Windows.Forms.Button 控件时发生。
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(false)]
public event EventHandler DoubleClick;
看 [Browsable(false)] 的说明
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 39);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
//this.button1.Click += new System.EventHandler(this.button1_Click);
//this.button1.DoubleClick += new System.EventHandler(this.button1_Click);
this.button1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.button1_Click);
在form1.cs里面:
private void button1_Click(object sender, MouseEventArgs e)
{
MessageBox.Show("double click");
}
发现这个函数不会被调用,调试也进不来。完全不能响应双击?
我没有添加其他任何的事件响应。谢谢!