private void OnMouseDown(object sender, MouseEventArgs e) { // We only care about double-clicks on the node itself, not the plus/minus part var hitTest = _treeView.HitTest(e.Location); if (hitTest.Location == TreeViewHitTestLocations.PlusMinus) { return; } // Use _mouseClicks and _lastMouseDown to detect double-clicks, and set _lastDoubleClick when detected ++_mouseClicks; DateTime now = _getCurrentTime(); if (_mouseClicks == 2) { int delta = (int)now.Subtract(_lastMouseDown).TotalMilliseconds; if (delta >= 0 && delta < SystemInformation.DoubleClickTime) { _lastDoubleClick = now; } _mouseClicks = 0; } _lastMouseDown = now; }
private void OnMouseDown(object sender, MouseEventArgs e) { // We only care about double-clicks on the node itself, not the plus/minus part var hitTest = _treeView.HitTest(e.Location); if (hitTest.Location == TreeViewHitTestLocations.PlusMinus) { return; } // Use _mouseClicks and _lastMouseDown to detect double-clicks, and set _lastDoubleClick when detected ++_mouseClicks; DateTime now = _getCurrentTime(); if (_mouseClicks == 2) { _mouseClicks = 0; } _lastMouseDown = now; }