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:
Generated
+2
@@ -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
|
||||
//
|
||||
|
||||
+15
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user