mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 14:25:16 +00:00
Improved the selection dragging on the tree view. The selection moves now only when the dragging starts on the tree view. With the old implementation, double-clicking the gadget would change the selection, because the mouse is still pressed when the main window is shown.
This commit is contained in:
2
GUI/MainForm.Designer.cs
generated
2
GUI/MainForm.Designer.cs
generated
@@ -463,7 +463,9 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.treeView.UseColumns = true;
|
||||
this.treeView.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(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
|
||||
//
|
||||
|
@@ -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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user