本方法采用在单击事件中中等待是否有双击的办法来处理;有一定的延时
private void Control_Click(System.Object sender, System.EventArgs e)
{BackgroundWorker workClick = new BackgroundWorker();
workClick.DoWork+=new DoWorkEventHandler(workClick_DoWork);
workClick.RunWorkerAsync();
}
//单击异步工作,处理单击双击并存问题
void workClick_DoWork(object sender, DoWorkEventArgs e)
{
System.Threading.Thread.Sleep(300);
if (!isDbClick)
{
this.Invoke((Action)(() =>
{
//单击逻辑
}));
}
isDbClick = false;
}
bool isDbClick = false;
private void Control_DoubleClick(object sender, EventArgs e)
{
isDbClick = true;
//双击逻辑
}