如何在windows下面点右键就选中listbox的列

来源:百度知道 编辑:UC知道 时间:2024/06/22 14:53:39
如题
我已经找到解决方法。有个事件
if(e.Button==MouseButtons.Right)//右键
{

int select= clickedListBox.IndexFromPoint(e.X, e.Y);
clickedListBox.SelectedItem = clickedListBox.Items
}

private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add("a");
listBox1.Items.Add("b");
}

private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
listBox1.SelectedIndex = 0;
}
}

它有个事件什么来着。我忘啦 你好好找找