C# CheckedListBox双击时,获取鼠标位置的选项

代码如下

        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也适用

posted @ 2013-10-21 22:44  逍遥子k  阅读(824)  评论(0编辑  收藏  举报