1 回答
TA贡献1852条经验 获得超1个赞
在 private void myListView_DragOver(object sender, DragEventArgs e) 我调整了你评论中的代码@HansPassant
var wPos = this.myListView.PointToClient(new Point(e.X, e.Y));
var targetItem = myListView.GetItemAt(wPos.X, wPos.Y);
if (targetItem != null)
{
var targetNodeInfo = targetItem.Tag as WindowsExplorerModel;
if (targetNodeInfo != null) //if dropping on a target item
{
if (targetNodeInfo.isFile)
e.Effect = DragDropEffects.None;//if IsFile
else
{
foreach (ListViewItem listItem in myListView.SelectedItems)
listItem.Selected = false;
targetItem.Selected = true;
e.Effect = DragDropEffects.Copy;
}
return;
}
}
- 1 回答
- 0 关注
- 157 浏览
添加回答
举报