private void tImg_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { TreeNode node = tImg.SelectedNode; if (node == null) { return; } ImageInfo ii = tImg.SelectedNode.Tag as ImageInfo; switch (e.KeyCode) { case Keys.Delete: if (ii.Delete()) { tImg.Nodes.Remove(tImg.SelectedNode); } break; case Keys.F2: tImg.LabelEdit = true; tImg.SelectedNode.BeginEdit(); break; } }
private void miImgDelete_Click(object sender, System.EventArgs e) { ImageInfo ii = tImg.SelectedNode.Tag as ImageInfo; if (ii.Delete()) { tImg.Nodes.Remove(tImg.SelectedNode); } }