Пример #1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (this.treeView1.SelectedNode == null)
            {
                return;
            }
            if (this.treeView1.SelectedNode.Level == 0)
            {
                return;
            }

            Model.Info_place_info update = this.treeView1.SelectedNode.Tag as Model.Info_place_info;

            FmPlaceInfo fm = new FmPlaceInfo(update);

            fm.Tag          = this.treeView1.SelectedNode.Parent.Tag;
            fm.SelectValue += (obj) => {
                Model.Info_place_info info = obj as Model.Info_place_info;
                this.treeView1.SelectedNode.Text = info.Place_Name;
            };
            fm.ShowDialog();
        }
Пример #2
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            if (this.treeView1.SelectedNode == null)
            {
                return;
            }

            Model.Info_place_info parent = this.treeView1.SelectedNode.Tag as Model.Info_place_info;
            FmPlaceInfo           fm     = new FmPlaceInfo();

            fm.Tag          = parent;
            fm.SelectValue += (obj) => {
                Model.Info_place_info info = obj as Model.Info_place_info;
                TreeNode node = new TreeNode(info.Place_Name);
                node.Tag        = info;
                node.ImageIndex = info.Level;

                this.treeView1.SelectedNode.Nodes.Add(node);
                parent.Children.Add(info);
                this.treeView1.SelectedNode.Tag = parent;
            };
            fm.ShowDialog();
        }