diff --git a/GUI/MainForm.Designer.cs b/GUI/MainForm.Designer.cs index 98e98be..335c7f9 100644 --- a/GUI/MainForm.Designer.cs +++ b/GUI/MainForm.Designer.cs @@ -463,7 +463,9 @@ namespace OpenHardwareMonitor.GUI { this.treeView.UseColumns = true; this.treeView.NodeMouseDoubleClick += new System.EventHandler(this.treeView_NodeMouseDoubleClick); this.treeView.Click += new System.EventHandler(this.treeView_Click); + this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); this.treeView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseMove); + this.treeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseUp); // // plotPanel // diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index b76a7a2..473f9d2 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -76,6 +76,8 @@ namespace OpenHardwareMonitor.GUI { private WmiProvider wmiProvider; + private bool selectionDragging = false; + public MainForm() { InitializeComponent(); @@ -629,9 +631,19 @@ namespace OpenHardwareMonitor.GUI { } private void treeView_MouseMove(object sender, MouseEventArgs e) { - if ((e.Button & (MouseButtons.Left | MouseButtons.Right)) > 0) { - treeView.SelectedNode = treeView.GetNodeAt(e.Location); - } + selectionDragging = selectionDragging & + (e.Button & (MouseButtons.Left | MouseButtons.Right)) > 0; + + if (selectionDragging) + treeView.SelectedNode = treeView.GetNodeAt(e.Location); + } + + private void treeView_MouseDown(object sender, MouseEventArgs e) { + selectionDragging = true; + } + + private void treeView_MouseUp(object sender, MouseEventArgs e) { + selectionDragging = false; } } }