Beispiel #1
0
        //添加子节点,并自动对PID,ID编号
        private void addNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 动态添加控件(控件放在窗体中)
            // ftmp = new EditForm();
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();
            DataRow  dr      = m_DesignDataTable.NewRow();

            // ftmp.Flag = true;
            if (tmpDialog.Show() == DialogResult.OK)
            {
                //添加子节点到树节点集合中
                try
                {
                    tmpNode.Text = tmpDialog.NodeName;
                    //tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    dr["PId"]            = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                    dr["Name"]           = tmpDialog.NodeName;
                    dr["RichTextString"] = "";
                    m_DesignDataTable.Rows.Add(dr);
                    tmpNode.Tag = dr["Id"];//object类型
                    tmpTree.SelectedNode.Nodes.Add(tmpNode);
                }
                catch
                {
                    MessageBox.Show("请选择根节点");
                }
                //展开所有的树节点
                tmpTree.ExpandAll();
            }
        }
Beispiel #2
0
        private void editNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // ftmp = new EditForm();
            int id = Convert.ToInt32(tmpTree.SelectedNode.Tag);

            tmpDialog = new EditDialog();
            //ftmp.Flag = false;
            //树节点的富文本框添加现在选中节点的名字
            try
            {
                tmpDialog.RichTextBox.Text = tmpTree.SelectedNode.Text;

                if (tmpDialog.Show() == DialogResult.OK)
                {
                    tmpTree.SelectedNode.Text = tmpDialog.NodeName;
                }

                switch (flag)
                {
                case 0: break;

                case 1:
                    DataRow[] rows = m_DesignDataTable.Select("Id='" + id + "'");
                    rows[0].BeginEdit();
                    rows[0]["Name"]           = tmpTree.SelectedNode.Text;
                    rows[0]["RichTextString"] = richTextBox.Rtf;
                    rows[0].EndEdit();
                    break;

                case 2:
                    DataRow[] rows1 = m_TestDataTable.Select("Id='" + id + "'");
                    rows1[0].BeginEdit();
                    rows1[0]["Name"] = tmpTree.SelectedNode.Text;

                    rows1[0].EndEdit();
                    break;
                }
                //tmpDialog.RichTextBox.Text = tmpTree.SelectedNode.Text;

                //if (tmpDialog.Show() == DialogResult.OK)
                //{

                //    tmpTree.SelectedNode.Text = tmpDialog.NodeName;
                //}
            }
            catch
            {
                MessageBox.Show("请选择节点");
            }
        }
Beispiel #3
0
        //添加根节点
        private void addRoot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //动态添加控件(控件放在窗体中)
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();
            DataRow  dr      = m_DesignDataTable.NewRow();

            //  ftmp.Flag = true;
            if (tmpDialog.Show() == DialogResult.OK)
            {
                //添加根节点到树节点集合中
                tmpNode.Text         = tmpDialog.NodeName;
                dr["PId"]            = 0;
                dr["Name"]           = tmpDialog.NodeName;
                dr["RichTextString"] = "";
                m_DesignDataTable.Rows.Add(dr);
                tmpNode.Tag = dr["Id"];//object类型
                tmpTree.Nodes.Add(tmpNode);
            }
        }
Beispiel #4
0
        private void editNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // ftmp = new EditForm();
            tmpDialog = new EditDialog();
            //ftmp.Flag = false;
            //树节点的富文本框添加现在选中节点的名字
            try
            {
                tmpDialog.RichTextBox.Text = tmpTree.SelectedNode.Text;

                if (tmpDialog.Show() == DialogResult.OK)
                {
                    tmpTree.SelectedNode.Text = tmpDialog.NodeName;
                }
            }
            catch
            {
                MessageBox.Show("请选择节点");
            }
        }
Beispiel #5
0
        //添加子节点,并自动对PID,ID编号
        private void addNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 动态添加控件(控件放在窗体中)
            // ftmp = new EditForm();
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();

            switch (flag)
            {
            case 0: break;

            case 1:
                DataRow dr = m_DesignDataTable.NewRow();
                // ftmp.Flag = true;
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text = tmpDialog.NodeName;
                        //tmpTree.SelectedNode.Nodes.Add(tmpNode);
                        dr["PId"]            = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr["Name"]           = tmpDialog.NodeName;
                        dr["RichTextString"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;

            case 2:
                DataRow dr1 = m_TestDataTable.NewRow();
                // ftmp.Flag = true;
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text = tmpDialog.NodeName;
                        //tmpTree.SelectedNode.Nodes.Add(tmpNode);
                        dr1["PId"]                  = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr1["Name"]                 = tmpDialog.NodeName;
                        dr1["PIdText"]              = tmpTree.SelectedNode.Text;
                        dr1["IdList"]               = "";
                        dr1["TestItendify"]         = "";
                        dr1["TestPriority"]         = "";
                        dr1["TraceRelationships"]   = "";
                        dr1["TestContent"]          = "";
                        dr1["TestReqResolve"]       = "";
                        dr1["AdequacyRequirements"] = "";
                        dr1["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr1);
                        tmpNode.Tag = dr1["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;
            }
        }
Beispiel #6
0
        //添加根节点
        private void addRoot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //动态添加控件(控件放在窗体中)
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();

            switch (flag)
            {
            case 0: break;

            case 1:
                //DataRow dr = m_DesignDataTable.NewRow();

                ////  ftmp.Flag = true;
                //if (tmpDialog.Show() == DialogResult.OK)
                //{
                //    //添加根节点到树节点集合中
                //    tmpNode.Text = tmpDialog.NodeName;
                //    dr["PId"] = 0;
                //    dr["Name"] = tmpDialog.NodeName;
                //    dr["RichTextString"] = "";
                //    m_DesignDataTable.Rows.Add(dr);
                //    tmpNode.Tag = dr["Id"];//object类型
                //    tmpTree.Nodes.Add(tmpNode);
                //}
                DataRow   dr   = m_DesignDataTable.NewRow();
                DataRow[] rows = m_DesignDataTable.Select("Id='1'");
                int       a    = rows.Count <DataRow>();
                if (a == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text = tmpDialog.NodeName;
                        dr["PId"]    = 0;
                        dr["Id"]     = 1;

                        dr["Name"]           = tmpDialog.NodeName;
                        dr["RichTextString"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    // DataRow dr1 = m_TestDataTable.NewRow();
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text = tmpDialog.NodeName;
                        dr["PId"]    = 0;

                        dr["Name"]           = tmpDialog.NodeName;
                        dr["RichTextString"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                break;

            case 2:
                // count++;

                DataRow   dr1   = m_TestDataTable.NewRow();
                DataRow[] rows1 = m_TestDataTable.Select("Id='1'");
                int       b     = rows1.Count <DataRow>();

                if (b == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text                = tmpDialog.NodeName;
                        dr1["PId"]                  = 0;
                        dr1["Id"]                   = 1;
                        dr1["PIdText"]              = "";
                        dr1["Name"]                 = tmpDialog.NodeName;
                        dr1["IdList"]               = "";
                        dr1["TestItendify"]         = "";
                        dr1["TestPriority"]         = "";
                        dr1["TraceRelationships"]   = "";
                        dr1["TestContent"]          = "";
                        dr1["TestReqResolve"]       = "";
                        dr1["AdequacyRequirements"] = "";
                        dr1["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr1);
                        tmpNode.Tag = dr1["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    // DataRow dr1 = m_TestDataTable.NewRow();
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text                = tmpDialog.NodeName;
                        dr1["PId"]                  = 0;
                        dr1["Name"]                 = tmpDialog.NodeName;
                        dr1["PIdText"]              = "";
                        dr1["IdList"]               = "";
                        dr1["TestItendify"]         = "";
                        dr1["TestPriority"]         = "";
                        dr1["TraceRelationships"]   = "";
                        dr1["TestContent"]          = "";
                        dr1["TestReqResolve"]       = "";
                        dr1["AdequacyRequirements"] = "";
                        dr1["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr1);
                        tmpNode.Tag = dr1["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }

                break;

            case 3:; break;

            case 4:; break;

            default: break;
            }
        }