问题
I have some grid scenario with > 500,000,000 rows I would like to display in ListView.
If I artificially limit my ListView to display 100,000,000:
_listView.VirtualListSize = _data.Count;
if (_listView.VirtualListSize > 100000000)
_listView.VirtualListSize = 100000000;
Everything works fine (In VirtualMode naturally). When I change my code to:
_listView.VirtualListSize = _data.Count;
if (_listView.VirtualListSize > 100000001)
_listView.VirtualListSize = 100000001;
The ListView display an empty grid... Is this a Microsoft Bug? Where is this coming from? Is this a Win32 ListView limitation? Most importantly, why is this not documented?
回答1:
It can't be done. As you have found, 100,000,000 is the absolute limit. MS never documented it (AFAIK), but the limit has been known for a long time: an answer from 2004.
On previous versions of Windows, trying more than 100,000,000 crashed the OS :)
On my XP and Vista machines, trying more than 100,000,000 rows limits the size to 9,999,999.
来源:https://stackoverflow.com/questions/2454942/is-winforms-listview-in-virtualmode-limited-to-100-000-000-rows