Here is how to select an item in a listbox when right-clicking:
C++
Code:
private: System::Void listBox1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
if (e->Button == System::Windows::Forms::MouseButtons::Right) {
listBox1->SelectedIndex = listBox1->IndexFromPoint(e->X, e->Y);
}
}
C#
Code:
private void LST_BX_MouseDown(object sender, MouseEventArgs e) {
if(e.Button == MouseButtons.Right)
LST_BX.SelectedIndex = LST_BX.IndexFromPoint(e.X, e.Y);
}