之前我问过一个关于我的dataGridView性能的问题,因为它显示了大量基于传入流添加的行.给出了多种解决方案,其中一种解决方案支持虚拟模式 MSDN有一篇关于这个主题的文章,但它感觉比我需要的更复杂,因为它使用数据库和可编辑字段.我的DataGridView仅用于显示,我显示的数据放在List中.
在我接受答案后,我收到了这个链接:http://www.codeproject.com/Articles/23937/PagingANN-with havenGridView-in-VirtualMode.即使使用数据库示例,它也更适合我需要的东西.包含我要显示的数据的My List声明如下:
List<ResultRow> captureResults = new List<ResultRow>();
Run Code Online (Sandbox Code Playgroud)
ResultRow对象定义如下:
/* Simplified */
public class ResultRow
{
private int first = 0;
private string second = "";
private UInt64 third = 0;
private IPAddress fourth = null;
/* etc */
public ResultRow()
{
}
public void Set (<the values>) //In actuallity a KeyValuePair
{
//field gets set here
}
public UInt64 Third
{
get { return third; }
set { third = value; }
} …Run Code Online (Sandbox Code Playgroud)