private void ListBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (ListBox1.SelectedIndex != -1) { ContextMenuStrip2.Show(Cursor.Position); } } else { ListBox1.SelectedIndex = ListBox1.IndexFromPoint(e.Location); } }