关于listbox的右键单击问题 怎样实现c# winform中listbox控件的右键单击事件,而且单击同时还要使item被选中,如何办到? 会的麻烦解决一下,谢了~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 处理MouseDow事件:不要设定ListBox的ContextMenu private void listbox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { int index = listbox1.IndexFromPoint(e.Location); if (index >= 0) { listbox1.SelectedIndex = index; this.deleteMenu.Show(this.listbox1,e.Location); } } } 这个算快速排序算法吗? C# 串口中断不能理想触发,触发时字节数不够的问题。 C# [调用API]来控制音量 如何让所有的子窗口全部重新加载一遍呀?请高手指点一下,谢谢。 在局域网上能否用POS方式操作小票打印机? C#动态生成图片验证码显示问题 如何寫上傳文件到指定一台機器? 如何取得Access中數據表的欄位信息 cs文件如何编译? 怎样重载带参数的构造函数? c#泛型集合的问题?高手帮忙 关于listbox的右键单击问题
不要设定ListBox的ContextMenu
private void listbox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{ int index = listbox1.IndexFromPoint(e.Location);
if (index >= 0)
{
listbox1.SelectedIndex = index;
this.deleteMenu.Show(this.listbox1,e.Location);
}
}
}