private void TreeView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { viewportLayout1.Entities.DeleteSelected(); TreeViewManager.DeleteSelectedNode(modelTree, viewportLayout1); viewportLayout1.Invalidate(); } }
private void ViewportLayout1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { TreeNode selectedNode = modelTree.SelectedNode; if (selectedNode != null && ((Entity)selectedNode.Tag).Selected) { // Removes all the nodes linked to the deleted entity TreeViewManager.DeleteSelectedNode(modelTree, viewportLayout1); } } }