private void button_Add(BoxExchangeEditor bx, List<string> src) { int pos = bx.SourceBox.SelectedIndex - bx.SourceBox.SelectedItems.Count; bx.addItems(bx.SourceBox, bx.TargetBox); reLoadButtonItem(bx, src); if (bx.SourceBox.Items.Count != 0) { pos = pos <= 1 ? 1 : pos; pos = Math.Max(0, Math.Min(pos, bx.SourceBox.Items.Count - 1)); bx.SourceBox.SelectedIndex = pos - 1;//順序がヘンだが、ENTERの場合はこの後に+1処理が入る模様 } }