private void TreeView_MouseUp(object sender, MouseEventArgs e)
        {
            TreeNode mouseNode = TreeView.GetNodeAt(e.Location);

            if (e.Button == MouseButtons.Right)
            {
                if (mouseNode is null)
                {
                    TreeContextMenuStrip.Show(TreeView, e.Location);
                }
                else
                {
                    TreeView.SelectedNode = mouseNode;
                    TreeItemContextMenuStrip.Show(TreeView, e.Location);
                }
            }
        }
Beispiel #2
0
        private void tvModel_Click(object sender, EventArgs e)
        {
            MouseEventArgs args = (MouseEventArgs)(e);

            if (args.Button == MouseButtons.Right)
            {
                ModelTreeNode tn = (ModelTreeNode)tvModel.GetNodeAt(new Point(args.X, args.Y));
                if (tn != null)
                {
                    TreeContextMenuStrip.Text            = tn.Text;
                    TreeContextMenuStrip.CurrentTreeNode = tn;
                    TreeContextMenuStrip.Show((TreeView)sender, args.X, args.Y);
                }
            }
            else if (args.Button == MouseButtons.Left)
            {
            }
        }