代码如下
private void chkProcedure_MouseDoubleClick(object sender, MouseEventArgs e) { int i = chkProcedure.IndexFromPoint(e.Location); if (i != CheckedListBox.NoMatches) MessageBox.Show(chkProcedure.Items[i].ToString()); }
其中CheckedListBox.NoMatches就是常数-1
该方法对于ListBox也适用