- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如何将项目从 Winforms-listview 控件拖到另一个控件(垃圾桶图片)上?
更新 1:
我认为基本流程是:
更新 2:
基本流程(基于答案):
最佳答案
为 ListView 的 ItemDrag 事件实现一个事件处理程序:
private void listView1_ItemDrag(object sender, ItemDragEventArgs e) {
DoDragDrop(e.Item, DragDropEffects.Move);
}
并为垃圾桶编写事件处理程序:
private void trashCan_DragEnter(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(typeof(ListViewItem))) {
e.Effect = DragDropEffects.Move;
}
// others...
}
private void trashCan_DragDrop(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(typeof(ListViewItem))) {
var item = e.Data.GetData(typeof(ListViewItem)) as ListViewItem;
item.ListView.Items.Remove(item);
}
// others...
}
您必须强制 PictureBox 的 AllowDrop 属性,它在“属性”窗口中不可用:
public Form1() {
InitializeComponent();
trashCan.AllowDrop = true;
}
关于C# - 将项目从 ListView 拖到垃圾桶中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2876139/
在 SmartGit(在 Windows 上)中删除未跟踪的文件时,您必须选择实际删除或“移至垃圾箱”。当我不能 100% 确定要删除某些内容时,我经常使用“移至垃圾箱”。我只是做了“将东西移到垃圾桶
问题如下: You have n trip lengths in km which should be divided among m number of days such that the max
我正在尝试弄清楚我应该对各种类型的数据使用哪种排序规则。我将存储的 100% 的内容都是用户提交的。 我的理解是我应该使用 UTF-8 通用 CI(不区分大小写)而不是 UTF-8 二进制。但是,我找
当我尝试使用命令行构建以下 Dockerfile 时 docker build -t my-image-name . FROM continuumio/miniconda3 EXPOSE 8880 #
我试图弄清楚我应该对各种类型的数据使用什么排序规则。我将存储的内容 100% 是用户提交的。 我的理解是我应该使用 UTF-8 通用 CI(不区分大小写)而不是 UTF-8 二进制。但是,我找不到 U
我的 Visual Studio 解决方案中有各种文件,如果我更改它,必须将其复制到 bin/Debug 文件夹。 我尝试设置Copy to Output Directory - Copy alway
更新(2015年5月): GDAA中已实现了“垃圾”功能,因此以下问题无关紧要。 原始问题: 在使用新的“Google Drive Android API”(GDAA)时,我遇到了一些我无法弄清的差异
我是一名优秀的程序员,十分优秀!