winform listbox增加鼠标双击事件
2021-06-29 22:06
标签:选中 sele rom 文件中 dex info system lis 事件处理
在Form.Designer.cs文件中对于listBox处理:
listBox.MouseDoubleClick += new system。Windows.Forms.MouseEventHandler(listBox1_MouseDoubleClick);
在Form.cs代码文件中增加函数:
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
int index = listBox1.IndexFromPoint(e.Location);
if(index != ListBox.NoMatches)
{
MessageBox.Show("这里是双击事件处理代码");
}
else
{
listBox1.SelectIndex = -1;
MessageBox.Show("没有选中Item");
}
}
完成!
winform listbox增加鼠标双击事件
标签:选中 sele rom 文件中 dex info system lis 事件处理
原文地址:https://www.cnblogs.com/VinceLiu/p/10000310.html
文章标题:winform listbox增加鼠标双击事件
文章链接:http://soscw.com/index.php/essay/99555.html