Quantcast
Channel: Rob Garrett - Blog » Code
Viewing all articles
Browse latest Browse all 10

Right-Click ListBox – Select Item

$
0
0

Useful to know – to select items in a ListBox with a right mouse click wire up the following code to the MouseDown event:

private void LB_MouseDown(object sender, MouseEventArgs e)
{
// Select item if right click.
if (MouseButtons.Right == e.Button)
{
Point pt = new Point(e.X, e.Y);
LB.SelectedIndex = LB.IndexFromPoint(pt);
}
}



Viewing all articles
Browse latest Browse all 10

Trending Articles