I have a treeview with checkbox, I\'m trying to disable the double click only when this is done in the checkbox.
I found a way to totally disable the double click bu
Option 1: Completely disable the double click event.
Create a customer control
class MyTreeView : TreeView
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0203)
{
m.Result = IntPtr.Zero;
}
else
{
base.WndProc(ref m);
}
}
}
and in your designer file ( form.Designer.cs ), look for where the control was created, and replace the call to TreeView constructor with your new control.
this.treeView1 = new MyTreeView();
Option 2: Treat a double click event as two single click events
class MyTreeView : TreeView
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0203)
{
m.Msg = 0x0201;
}
base.WndProc(ref m);
}
}
Personally I think option 2 is more intuitive. When user clicks the check box twice, the checkbox is not checked.