简体   繁体   English

显示大量数据

[英]Displaying a Large Amount of Data

I'm working on a media library mock-up and I have a database of songs (over 9,000 tracks) that I want to display and make sortable. 我正在制作一个媒体库模型,我有一个歌曲数据库(超过9,000首曲目),我想要显示并进行排序。 I'm not sure which GUI control would be best to use and I am not sure how it would be best to add all of the entries to the control. 我不确定哪种GUI控件最好用,我不确定如何将所有条目添加到控件中。

Obviously using a listview and adding each entry one at a time takes a long time. 显然,使用列表视图并一次添加一个条目需要长时间。 Currently, the database is returning all of the tracks in an array of media objects ( mediaEntry[] - a struct I defined). 目前,数据库正在返回媒体对象数组中的所有轨道( mediaEntry[] - 我定义的结构)。 I don't know much about .NET's databinding system and any performance benefit that may bring. 我不太了解.NET的数据绑定系统以及可能带来的任何性能优势。

The database is also searchable so I'll be changing the information displayed in the GUI control depending on the search terms. 数据库也是可搜索的,因此我将根据搜索条件更改GUI控件中显示的信息。

Something like DataGridView or ListView in "virtual mode" should work well; “虚拟模式”中的 DataGridViewListView这样的东西应该可以正常工作; this avoids the need to process all the data up-front. 这避免了预先处理所有数据的需要。

however - I doubt that mediaEntry should be a struct - sounds like a class to me. 但是 - 我怀疑mediaEntry应该是一个struct - 对我来说听起来像是一个class It is very rare you write a struct in .NET 在.NET中编写struct非常罕见的

The Listview control has a virtual mode, where you supply the viewable data on demand. Listview控件具有虚拟模式,您可以根据需要提供可查看的数据。 Its actually easier to use than it sounds. 它实际上比听起来更容易使用。 Checkout the VirtualMode property and the RetrieveVirtualItem event. 签出VirtualMode属性和RetrieveVirtualItem事件。

You may want to give ObjectListView a try. 您可能想尝试一下ObjectListView It's very handy to use and has excellent performance when used appropriately . 它使用起来非常方便,并且在适当使用时具有出色的性能。

Note: I'm not the developer of this library, I'm advertising it just because I used it in one of my projects. 注意:我不是这个库的开发者,我只是因为我在我的一个项目中使用它而做广告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM