private void listBox1_MouseUp(object sender, MouseEventArgs e) { int index = listBox1.IndexFromPoint(e.Location); if ((e.Button == MouseButtons.Right) && (index != -1) && (index < listBox1.Items.Count)) { listBox1.SelectedIndex = listBox1.IndexFromPoint(e.Location); frmPreview preview = new frmPreview(headends[index].Lineup); preview.ShowDialog(); } }
private void listBox1_MouseUp(object sender, MouseEventArgs e) { var index = listBox1.IndexFromPoint(e.Location); if ((e.Button != MouseButtons.Right) || (index == -1) || (index >= listBox1.Items.Count)) { return; } listBox1.SelectedIndex = listBox1.IndexFromPoint(e.Location); var preview = new frmPreview(_headends[index].Lineup.Trim()); preview.ShowDialog(); }