コード例 #1
0
        protected override void OnKeyDown(KeyEventArgs args)
        {
            if (SelectedNode != null)
            {
                switch (args.KeyData)
                {
                case Keys.Delete: SelectedNode.Delete(); break;

                case Keys.X | Keys.Control: SelectedNode.CutToClipboard(); break;

                case Keys.C | Keys.Control: SelectedNode.CopyToClipboard(); break;

                case Keys.V | Keys.Control: SelectedNode.PasteFromClipboard(); break;

                case Keys.F2: SelectedNode.Rename(); break;

                default: base.OnKeyDown(args); return;
                }
                args.Handled = true;
            }
            else
            {
                base.OnKeyDown(args);
            }
        }
コード例 #2
0
        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (SelectedNode != null)
            {
                SelectedNode.Delete();
            }

            Cursor.Current = Cursors.Default;
        }