我如何使TreeControl的加载更快! [英] How do i make the loading of treecontrol more faster!

查看:91
本文介绍了我如何使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

推荐答案

因此您设置了一个树控件,该控件具有40,000个元素,所有元素都位于根目录,您担心是否需要2分钟才能填充?这是INSANE UI,我假设您希望您的用户现在在根目录下添加元素,以便树控件可以执行任何操作,并且它们有40,000个元素可用于搜索?
我认为您的用户界面需要重新考虑. .003秒是将项目插入树状视图所需的合理时间.
So you set up a tree control, with 40,000 elements, all at the root, and you''re worried that it takes 2 minutes to populate ? This is INSANE UI, I assume you expect your user to now add elements below the root, for the tree control to do anything, and they have 40,000 elements to search through ?

I think your UI needs a rethink. .003 of a second is a reasonable amount of time for it to take to insert an item into a treeview.


这篇关于我如何使TreeControl的加载更快!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆