// добавление/редактирование элемента private void EditItem(bool isEdit) { ItemForm itemForm = new ItemForm(isEdit); if (isEdit) { itemForm.param = passTree.SelectedNode.Text; itemForm.value = passTree.SelectedNode.ToolTipText; } itemForm.ShowDialog(); if (itemForm.param == "" || itemForm.value == "") { return; } int imgInd = PassportLib.Passport.GetImageIndex(itemForm.param) + 3; if (isEdit) { passTree.SelectedNode.Text = itemForm.param; passTree.SelectedNode.ToolTipText = itemForm.value; passTree.SelectedNode.ImageIndex = imgInd; passTree.SelectedNode.SelectedImageIndex = imgInd; } else { TreeNode newNode = new TreeNode(itemForm.param, imgInd, imgInd) {ToolTipText = itemForm.value}; passTree.SelectedNode.Nodes.Add(newNode); } }