コード例 #1
0
 private void btnChangeNode_Click(object sender, EventArgs e)
 {
     CreateCategoryForm frm = new CreateCategoryForm(tvCategoryTree.SelectedNode.Text);
     if (frm.ShowDialog() == DialogResult.OK)
     {
         categoryManagement.ChangeTreeNode(tvCategoryTree.SelectedNode, (string)frm.Tag);
         InitializeUI();
     }
 }
コード例 #2
0
        private void btnAddSubCategory_Click(object sender, EventArgs e)
        {
            CreateCategoryForm frm = new CreateCategoryForm();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                TreeNode newNode = categoryManagement.CreateTreeNode((string)frm.Tag, tvCategoryTree.SelectedNode.Name + "\\" + (string)frm.Tag, ((Category)tvCategoryTree.SelectedNode.Tag).Id);

                tvCategoryTree.SelectedNode.Nodes.Add(newNode);
                tvCategoryTree.SelectedNode.Expand();
                tvCategoryTree.SelectedNode = newNode;
            }
        }