开发者

Disabling A Form Element To Refresh? [duplicate]

This q开发者_开发知识库uestion already has answers here: Closed 11 years ago.

Possible Duplicate:

.NET Listview Refresh

I'm adding 50k~ish items to a list view and it refreshes each time (this is slowing it down big time). How can I disable the redrawing of the form, and enable it when it's done adding all of the items?


How about adding it to a collection and binding this collection to the DataSource property of the list control only once:

IList<Foo> items = FetchFoos();
myList.DataSource = items;

Of course if fetching 50k items is slow you might consider a BackgroundWorker to avoid freezing the UI (as a user I hate when my UI freezes).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜