You can capture the double click by keeping track of the time between
clicks. Here's an example using the MouseDown event. Note that you could
use the Click event just as easily.
using System;
using System.Drawing;
using System.Windows.Forms;
class DoubleClickCombo : Form
{
ComboBox box = new ComboBox();
// Keeps track of the time of the last click
DateTime LastClick = DateTime.Now;
public DoubleClickCombo()
{
// Combo box
box.Location = new Point(5, 5);
box.Parent = this;
box.MouseDown += new MouseEventHandler(box_MouseDown);
}
private void box_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
TimeSpan Current = DateTime.Now - LastClick;
TimeSpan DblClickSpan =
TimeSpan.FromMilliseconds(SystemInformation.DoubleClickTime);
if (Current.TotalMilliseconds <= DblClickSpan.TotalMilliseconds)
{
// Code to handle double click goes here
}
LastClick = DateTime.Now;
}
}
}
--------------------