using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CodeWalker.WinForms { public partial class TreeViewFix : TreeView { public TreeViewFix() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } protected override void WndProc(ref Message m) { if (m.Msg == 0x203) // double click { var localPos = PointToClient(Cursor.Position); var hitTestInfo = HitTest(localPos); if (hitTestInfo.Location == TreeViewHitTestLocations.StateImage) m.Result = IntPtr.Zero; else base.WndProc(ref m); } else base.WndProc(ref m); } } }