CodeWalker/CodeWalker.WinForms/TreeViewFix.cs
2017-09-21 20:33:05 +10:00

41 lines
1000 B
C#

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);
}
}
}