public static void SelectAll(this ListBox a_listBox)
{
a_listBox.BeginUpdate();
try
{
int topIndex = a_listBox.IndexFromPoint(0, 0);
int selectedIndex = a_listBox.SelectedIndex;
for (int i = 0; i < a_listBox.Items.Count; i++)
a_listBox.SetSelected(i, true);
if (selectedIndex != -1)
{
a_listBox.SetSelected(selectedIndex, false);
a_listBox.SetSelected(selectedIndex, true);
}
a_listBox.TopIndex = topIndex;
}
finally
{
a_listBox.EndUpdate();
}
}
2010-03-12
ListBox.SelectAll()
W .NET nie ma takiej metody, a przydałaby się.
Subskrybuj:
Komentarze do posta (Atom)
Brak komentarzy:
Prześlij komentarz