mfc如何用按钮控件为树控件添加节点
我想通过Add按钮为树控件添加节点,根据组合框所选的年级添加节点到相应的年级之下,但是每次添加数据都是出现图片中的情况,请求大佬讲解,代码如下UpdateData(tru...
我想通过Add按钮为树控件添加节点,根据组合框所选的年级添加节点到相应的年级之下,但是每次添加数据都是出现图片中的情况,请求大佬讲解,代码如下UpdateData(true); CString grade; switch (this->m_Grade.GetCurSel()) { case 0: this->m_TreeCon.InsertItem(this->m_Name, root1); this->m_TreeCon.Expand(root, TVE_EXPAND); this->m_TreeCon.Expand(root1, TVE_EXPAND); grade = "一年级"; break; case 1: this->m_TreeCon.InsertItem(this->m_Name, root2); this->m_TreeCon.Expand(root, TVE_EXPAND); this->m_TreeCon.Expand(root2, TVE_EXPAND); grade = "二年级"; break; case 2: this->m_TreeCon.InsertItem(this->m_Name, root3); this->m_TreeCon.Expand(root, TVE_EXPAND); this->m_TreeCon.Expand(root3, TVE_EXPAND); grade = "三年级"; break; } //将数据保留到对象数组中 count++; stu[count - 1].name = this->m_Name; stu[count - 1].ID = this->m_ID; stu[count - 1].grade = grade; stu[count - 1].sub1 = this->m_Sub1; stu[count - 1].sub2 = this->m_Sub2; stu[count - 1].sub3 = this->m_Sub3; UpdateData(false);
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询