So far, the quikest way I have found to select all items in a list box
is to turn off updates, set a wait cusror and then call SetSelected on
each item (see below), but it's too slow when the control is populated
with tens of thousands of items.
Ideally the wait-cursor shouldn't be needed as I hadn't anticipated a
select-all operation taking a noticeable amount of time. Has anyone
found a way to make this appear instantaneous as it would be in MFC?
Many thanks,
Duncan.
private void selectAllToolStripMenuItem_Click(object sender, EventArgs
e)
{
if( Messages.Items.Count 0 )
{
Messages.BeginUpdate();
Cursor prevCursor = Cursor;
Cursor = Cursors.WaitCursor;
for( int ii = 0; ii < Messages.Items.Count; ++ii )
{
Messages.SetSelected(ii, true);
}
Messages.EndUpdate();
Cursor = prevCursor;
}
}