Is there a way to make the right mouse button actually select an item in
a listbox as well as popup the associated context menu?
This is what I use for doing exactly that on my TreeView - I'm sure
you can adapt it for use in the Listbox!
protected override void OnMouseDown(MouseEventArgs e)
{
ase.OnMouseDown(e);
if (e.Button == MouseButtons.Right)
{
Point pt = new Point(e.X, e.Y);
this.PointToClient(pt);
TreeNode oCurrNode = this.GetNodeAt(pt);
if (oCurrNode == null)
return;
if (oCurrNode.Bounds.Contains(pt))
{
this.SelectedNode = oCurrNode;
}
}
}
Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch