private void BrowseNodesTV_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { TreeNode tn = BrowseNodesTV.GetNodeAt(e.X, e.Y); if (tn != null) { BrowseNodesTV.SelectedNode = tn; } } }
/// <summary> /// Ensures the correct node is selected before displaying the context menu. /// </summary> private void BrowseNodesTV_MouseDown(object sender, MouseEventArgs e) { try { BrowseNodesTV.SelectedNode = BrowseNodesTV.GetNodeAt(e.X, e.Y); } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }