private void listBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { indexFirst = -1; tournament = -1; listBox1.Capture = true; int index = listBox1.IndexFromPoint(e.Location); if ((index >= 0) && (index < listBox1.Items.Count)) { var item = listBox1.Items[index]; string name = item.ToString(); CEngine eng = FormChess.engineList.GetEngine(name); indexFirst = index; tournament = eng.tournament > 0 ? 0 : 1; if (eng.SetTournament(tournament == 1)) { listBox1.Refresh(); if (engine == eng) { SelectEngine(); } } } } }
void SelectEngines(int first, int last, bool t) { int f = first < last ? first : last; int l = first < last ? last : first; bool r = false; for (int n = f; n <= l; n++) { var item = listBox1.Items[n]; string name = item.ToString(); CEngine eng = FormChess.engineList.GetEngine(name); if (eng.SetTournament(t)) { r = true; } } if (r) { listBox1.Refresh(); SelectEngine(); } }