慢TreeView节点标签重命名 [英] Slow TreeView node label rename

查看:107
本文介绍了慢TreeView节点标签重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for(int i =0;i<400;i++)
{
     treeNodes[i].Text = name;
     treeNodes[i].group[i].BackColor = Color.LightBlue;
}



此循环最多可能需要花费我的计算机2分钟的时间.但是删除标签重命名可以消除所有滞后.



This loop can take my computer up to 2 minutes. But removing the label rename removes all the lag.

for(int i =0;i&lt;400;i++)
{
     //treeNodes[i].Text = name;
     treeNodes[i].group[i].BackColor = Color.LightBlue;
}



为什么400个标签重命名的任何线索都应该使系统陷入瘫痪,我该如何解决?

________________

这是Winform,所以我要做的就是



Any clue why 400 label renames should bog the system down and how do I fix it?

________________

It is a winform so all I needed to do was

treeView1.BeginUpdate();
//tree editing stuff
treeView1.EndUpdate();


这消除了所有滞后.


This removed all lag. Thanks!

推荐答案

这是WinForms吗?

您是否尝试过将代码包装在BeginUpdateEndUpdate调用中?

尼克
Is this WinForms?

Have you tried wrapping your code in BeginUpdate and EndUpdate calls?

Nick


这篇关于慢TreeView节点标签重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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