/// <summary> 右键节点显示菜单
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mindMap_Panel1_MindMapNodeMouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                MindMapNodeContainer contentTemp = (MindMapNodeContainer)sender;
                if (contentTemp == null)
                {
                    return;
                }
                TestEntity   TestEntityTemp = (TestEntity)(contentTemp.DataItem);
                frmRightMenu frm            = new frmRightMenu();
                frm.Dir = new DirectoryInfo(TestEntityTemp.Path);

                frm.AddFolder        += new EventHandler(添加同级文件夹ToolStripMenuItem_Click);
                frm.AddChidrenFolder += new EventHandler(添加子文件夹ToolStripMenuItem1_Click);
                frm.ResetName        += new EventHandler(重命名QToolStripMenuItem_Click);
                frm.DeleteFolder     += new EventHandler(除文件夹ToolStripMenuItem_Click);

                frm.Show();
                Point PointTemp = this.PointToScreen(new Point(this.Size.Width, this.Size.Height));
                PointTemp.X = PointTemp.X - frm.Width;
                PointTemp.Y = PointTemp.Y - frm.Height;
                frm.Left    = Control.MousePosition.X < PointTemp.X ? Control.MousePosition.X : PointTemp.X;
                frm.Top     = Control.MousePosition.Y < PointTemp.Y ? Control.MousePosition.Y : PointTemp.Y;

                //frm.Location = Control.MousePosition;
                //RightKey_Menu.Show(Control.MousePosition);
            }
        }
        /// <summary> 用于编辑的TextBox按下回车完成编辑,按下esc取消编辑
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Edit_textBox_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Enter:
                List <MindMapNodeContainer> MindMapNodeContainerList = mindMap_Panel1.GetSelectedNode();
                MindMapNodeContainer        CurrentNode = MindMapNodeContainerList.FirstOrDefault();
                if (CurrentNode != null)                    //必须有被选中节点
                {
                    if (CurrentNode.DataItem is TestEntity) //被选中节点数据类型必须为TestEntity
                    {
                        TestEntity CurrentData = (TestEntity)CurrentNode.DataItem;
                        string     StrPath     = Path.GetDirectoryName(CurrentData.Path);
                        StrPath = StrPath + @"\" + Edit_textBox.Text;
                        if (!Directory.Exists(StrPath))
                        {
                            DirectoryInfo DirectoryInfoTemp = new DirectoryInfo(CurrentData.Path);
                            DirectoryInfoTemp.MoveTo(StrPath);

                            CurrentData.Text = Edit_textBox.Text;
                            CurrentData.Path = StrPath;
                            CurrentNode.NodeContent.DataItem = CurrentData;
                        }
                    }
                }
                Edit_textBox.Visible = false;
                break;

            case Keys.Escape:
                Edit_textBox.Visible = false;
                break;
            }
            //e.Handled = true;
        }
        /// <summary> 获取当前选中的节点内容
        ///
        /// </summary>
        /// <returns></returns>
        private MindMapNodeContentBase GetCurrentContent()
        {
            if (!IsSelectedOne())
            {
                return(null);                 //多个节点被选中
            }
            List <MindMapNodeContainer> MindMapNodeContainerList = mindMap_Panel1.GetSelectedNode();
            MindMapNodeContainer        CurrentNode = MindMapNodeContainerList.FirstOrDefault();

            if (CurrentNode == null)
            {
                return(null);                    //必须有被选中节点
            }
            return(CurrentNode.NodeContent);
        }
        /// <summary> 双击节点打开文件夹
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mindMap_Panel1_MindMapNodeMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            MindMapNodeContainer contentTemp = (MindMapNodeContainer)sender;

            if (contentTemp == null)
            {
                return;
            }
            TestEntity TestEntityTemp = (TestEntity)(contentTemp.DataItem);

            Process.Start(TestEntityTemp.Path);
        }
        private void 添加同级文件夹ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MindMapNodeContentBase MindMapNodeContentBase = GetCurrentContent();

            if (MindMapNodeContentBase == null)
            {
                return;
            }
            MindMapNodeContainer MindMapNodeContainer = MindMapNodeContentBase.NodeContainer.ParentNode;

            if (MindMapNodeContainer == null)
            {
                return;                      //没有父节点直接返回
            }
            AddFolder(MindMapNodeContainer); //添加一个文件夹
        }
        /// <summary> 拖动选中节点
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mindMap_Panel1_MindeMapNodeToNodeDragDrop(object sender, DragEventArgs e)
        {
            MindMapNodeContainer DragTarget  = (MindMapNodeContainer)sender;
            TestEntity           Entityarget = (TestEntity)DragTarget.DataItem;

            mindMap_Panel1.GetSelectedBaseNode().ForEach(T1 => {
                if (T1.DataItem != null && T1.DataItem is TestEntity)
                {
                    TestEntity TestEntityItem       = (TestEntity)T1.DataItem;
                    string PathStr                  = TestEntityItem.Path;
                    DirectoryInfo DirectoryInfoTemp = new DirectoryInfo(PathStr);
                    DirectoryInfoTemp.MoveTo(Entityarget.Path + "\\" + DirectoryInfoTemp.Name);
                    TestEntityItem.Path = DirectoryInfoTemp.FullName;
                    T1.ParentNode       = DragTarget;
                }
            });
        }
        /// <summary> 按照默认文件名添加一个文件夹
        ///
        /// </summary>
        /// <param name="ContainerParame">需要添加文件夹的节点</param>
        private void AddFolder(MindMapNodeContainer ContainerParame)
        {
            TestEntity    TestEntityTemp = (TestEntity)(ContainerParame.DataItem);
            string        FileName       = GetMinDefaultsFolderName(TestEntityTemp.Path);
            DirectoryInfo CreatedFolder  = new DirectoryInfo(TestEntityTemp.Path).CreateSubdirectory(FileName);

            TestEntity NewTestEntity = new TestEntity();

            NewTestEntity.ParentID = TestEntityTemp.ID;
            NewTestEntity.ID       = GetID();
            NewTestEntity.Path     = CreatedFolder.FullName;
            NewTestEntity.Text     = CreatedFolder.Name;

            MindMapNodeContainer MindMapNodeContainerTemp = new MindMapNodeContainer();

            MindMapNodeContainerTemp.SetNodeContent <File_NodeContent>(ContainerParame.DataStruct);
            MindMapNodeContainerTemp.NodeContent.DataItem = NewTestEntity;
            ContainerParame.AddNode(MindMapNodeContainerTemp);

            mindMap_Panel1.GetSelectedNode().ForEach(T1 => T1.NodeContent.Selected = false); //取消所有选中
            MindMapNodeContainerTemp.NodeContent.Selected = true;                            //选中刚添加的
        }