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
Combining the above answers, I found this to be the best solution for me. Double clicking on a node to expand its children still works, only double clicking on a checkbox is affected and fixed:
class MyTreeView : TreeView
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0203 && this.CheckBoxes)
{
var localPos = this.PointToClient(Cursor.Position);
var hitTestInfo = this.HitTest(localPos);
if (hitTestInfo.Location == TreeViewHitTestLocations.StateImage)
{
m.Msg = 0x0201;
}
}
base.WndProc(ref m);
}
}