Here is how to select an item in a listbox when right-clicking:
C++
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); } }
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); }
Nice code. I've never really thought about right-clicking and selecting. It seems like a feature that should already be imbedded int he code.
You would think this would be default code.....
Void
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks