private void OnListBoxSelectedIndexChanged(object sender, EventArgs e)
{
// Only interested in changes of selected index
if (_lastSelectedIndex != _listBox.SelectedIndex)
{
_lastSelectedIndex = _listBox.SelectedIndex;
UpdateStateAndPalettes();
_listBox.Invalidate();
OnSelectedIndexChanged(e);
}
}