我做了一个带有拖放的列表框丢弃物品 拖放工作完美 但如果我只点击任何项目,它会将其添加到列表中 我没有尝试更改阻力阈值,因为我不知道如何进行rach并更改SystemParameterInfo。
private void listBox1_MouseDown (object sender, MouseEventArgs e) {
if (listBox1.Items.Count == 0) return;
int index = listBox1.IndexFromPoint(e.X, e.Y);
string s = listBox1.Items[index].ToString();
DragDropEffects dde1 = DoDragDrop(s, DragDropEffects.All);
if (dde1 == DragDropEffects.All) {
listBox1.Items.RemoveAt(listBox1.IndexFromPoint(e.X, e.Y));
}
}