C# ListControl的一个毫无头绪的问题
我在使用.NET Framework 4 和 VS 2010的过程中 在Winform中使用了一些ListBox CheckedListBox等继承自ListControl的控件时
发生了一些莫名奇妙 让我毫无头绪的问题
很简单的往form中加入一个ListBox/CheckedListBox 接着往ListBox/CheckedListBox的Items中加入一些Item
listBox1.Items.Add("abc");
listBox1.Items.Add("bcd");
listBox1.Items.Add("cde");
listBox1.Items.Add("def");
listBox1.Items.Add("efg");
然后运行程序
很高兴的是,窗体出来了 Listbox也显示出来了
看似一切正常
但是 当我点击ListBox中列出的item时 让人崩溃的事情发生了
你慢慢的点击 "abc" 再慢慢的点击一下 没问题
可是如果你的两次点击能形成一个 DoubleClick 那么你会惊奇的发现 SelectedIndex竟然移动到 "cde" 上了
这个问题我测试过 不是每台电脑都会出现这个情况
一开始是在我同事的电脑上发生了这种情况 我们百思不得其解
但渐渐的 又多了几台电脑感染上了这个毛病
listBox1.Items.Add("abc");
listBox1.Items.Add("abc");
listBox1.Items.Add("cde");
listBox1.Items.Add("abc");
listBox1.Items.Add("abc");
listBox1.Items.Add("abc");
listBox1.Items.Add("abc");
listBox1.Items.Add("cde");
listBox1.Items.Add("abc");
listBox1.Items.Add("abc");
如果按上面这种方式添加
点击两个 "cde" 中间的item时 SelectedIndex会自动移动到第二个 "cde" 上
点击第二个 "cde" 之后的item时 SelectedIndex会自动移动到第一个 "cde" 上
求教~~~~~
万分感谢~~~~~