本文介绍了我如何使TreeControl的加载更快!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我是VC ++编程的新手,有人可以通过TreeControl来帮助我.
大约有40000个元素(存储在一个数组中)要加载到Treecontrol中,大约需要2分钟,有人建议我一种更好,更快的方法吗?
代码片段是这样的:
Hello,
I am new to VC++ programming, could anyone help me with TreeControl.
There are around 40000 elements(stored in an array) to be loaded to a Treecontrol and it takes around 2 minutes, does anyone suggest me a better and faster way?
The snippet of code is something like this:
int CDerivedfromTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
unsigned int i,k;
CTreeCtrl &controlList = (CTreeCtrl &) GetTreeCtrl();
if (CTreeView::OnCreate(lpCreateStruct) == -1)
return -1;
controlList.ModifyStyle(0L, TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_NOTOOLTIPS | TVS_SHOWSELALWAYS );
controlList.SetRedraw(TRUE);
if(controlList.GetCount() )
controlList.DeleteAllItems();
controlList.SetRedraw(FALSE);
for(i=0;i<global_Total_No_Of_Items;i++)
{
controlList.InsertItem( (LPCTSTR)items[i].name ,TVI_ROOT,TVI_LAST);
}
controlList.SetRedraw(TRUE);
SplitterWindow = CView::GetParentSplitter(this, TRUE);
return 0;
}
预先感谢,
RafiM
Thanks in advance,
RafiM
推荐答案
这篇关于我如何使TreeControl的加载更快!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!