双击事件 [英] double click event
本文介绍了双击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的按钮没有双击事件,我需要此事件
我该怎么办?
请给我解决方案
Hi,
I don''t have double click event in my button and i need this event
what i do?
please give me solution
推荐答案
此事件确实存在,但无法浏览,因此您无法在WinForms设计器中看到它,如下所述:
http://msdn.microsoft.com/de-de/library/system.windows.forms.button.doubleclick.aspx [ ^ ]
这是使用代码执行的代码片段:
This event does exist but ís not browsable, so you don''t see it in the WinForms designer as described here:
http://msdn.microsoft.com/de-de/library/system.windows.forms.button.doubleclick.aspx[^]
Here is a snippet to do it using code:
public Form1()
{
InitializeComponent();
button1.DoubleClick += new EventHandler(button1_DoubleClick);
}
void button1_DoubleClick(object sender, EventArgs e)
{
}
另外,您需要从以下按钮派生按钮类:
Additionally you need to derive your button class from:
class DoubleClickButton : Button
{
public DoubleClickButton()
: base()
{
SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, true);
}
}
设置ControlStyles属性以允许双击.
Which sets the ControlStyles property to allow double clicks.
选中此
Button.DoubleClick事件 [
Check this
Button.DoubleClick Event[^]
这篇关于双击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文