[C#]怎么为一个button写双击事件呢

podded 2003-12-14 09:27:18
button只有click,怎么让一个button有双击事件呢?
...全文
173 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hifrog 2003-12-14
  • 打赏
  • 举报
回复
the interval between the two clicks is accoding to the os settings.
gordenfl 2003-12-14
  • 打赏
  • 举报
回复
在初始化函数里面写
button1.DoubleClick +=System.EventHandle("函数名");
podded 2003-12-14
  • 打赏
  • 举报
回复
thx a lot.
It's ok.

But what is the interval between the two clicks?
zhengguoc 2003-12-14
  • 打赏
  • 举报
回复
谁说c#没有双击事件?怪了!这不是吗
System.Windows.Forms.Button a;
a.DoubleClick +=new EventHandler(a_DoubleClick);
FileNewExit 2003-12-14
  • 打赏
  • 举报
回复
perhaps this works:

private void button_MouseDown(object sender,System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left && e.Clicks == 2){
//Double click
}
}
xiangz123 2003-12-14
  • 打赏
  • 举报
回复
好像不行吧,它只有单击事件。

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧