fyi, this is what I came up with for a solution unless someone has an easier way:
private void listBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ if(e.Button == MouseButtons.Right) { for (int i = 0; i < listBox1.Items.Count; i++) { Rectangle r = new Rectangle(0, i*listBox1.ItemHeight, listBox1.Width, listBox1.ItemHeight); if (r.Contains(e.X, e.Y)) { listBox1.SelectedIndex = i; i = listBox1.Items.Count; //break the loop } } } }
|