Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I don't have double click event in my button and i need this event
what i do?
please give me solution
Posted
Comments
Rickin Kane 10-Sep-12 4:20am    
is it web or windows
amirmohamad 10-Sep-12 4:25am    
windows form

 
Share this answer
 
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:
C#
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:
C#
class DoubleClickButton : Button
   {
      public DoubleClickButton()
         : base()
      {
         SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, true);
      }
   }

Which sets the ControlStyles property to allow double clicks.
 
Share this answer
 
v2
Comments
amirmohamad 10-Sep-12 4:35am    
tank's bro
5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900