首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

ctreectrl insertitem 插入首元素,该怎么解决

2012-03-02 
ctreectrl insertitem 插入首元素大家好:有个问题想请教大家,vc中ctreeCtrl类中insertitem怎样插入首元素.

ctreectrl insertitem 插入首元素
大家好:   有个问题想请教大家,vc   中ctreeCtrl   类中insertitem   怎样插入首元素.

msdn  

HTREEITEM   InsertItem(
      LPCTSTR   lpszItem,
      HTREEITEM   hParent   =   TVI_ROOT,
      HTREEITEM   hInsertAfter   =   TVI_LAST  
);

hInserAfter   表试在什么元素后插入元素.   这样的话就不能在根元素下插入元素
 


[解决办法]
应该直接用InsertItem就可以了,我只这样做的 .
UINT num = this-> m_tree1.GetCount();
this-> m_tree1.InsertItem( "新建计算模型 ",hItemroot);
this-> m_tree1.Expand(hItemroot,TVE_EXPAND);
这是根结点,
插入选项部分

hItemtotal = this-> m_tree2.InsertItem( "总体信息 ");//插入子节点。
hItemcorrectnum = this-> m_tree2.InsertItem( "修正系数 ");
hIteminputpara = this-> m_tree2.InsertItem( "输入参数 ");
hItemaffectpara = this-> m_tree2.InsertItem( "影响因素 ");
hItemtablepara = this-> m_tree2.InsertItem( "查表参数 ");
hItemformula = this-> m_tree2.InsertItem( "计算公式 ");

热点排行