On Mon, 4 Apr 2005 17:40:35 +0800, cyshao wrote:
How to control the scroolbar.location of ListView?
I have a ListView with many items.
I want to locate ListView scrollBar to bottom, top, or some item.
How can I do that ?
You could do something like this:
Setting it to the top:
ListViewItem firstItem = _lstTest.Items[0];
firstItem.EnsureVisible();
Setting it to the bottom:
ListViewItem lastItem = _lstTest.Items[_lstTest.Items.Count - 1];
lastItem.EnsureVisible();
So the secret is "EnsureVisible()". If you have the ListViewItem just call
EnsureVisible().
hth
--
Claudio Grazioli
http://www.grazioli.ch