Kri*_*ian 5 c# datagridview file
我有以下DataGrid名字gridOperations.我已设置AllowDrop为true,并使用以下代码:
private void gridOperations_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (var filePath in files)
{
MessageBox.Show(filePath);
}
}
}
private void gridOperations_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.All;
else
e.Effect = DragDropEffects.None;
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将文件拖入时DataGrid,它会给我"停止"光标.我究竟做错了什么?
是可能的,因为它绑定到列表?
基本上我需要的是将文件中的文件名拖入数据网格并确定拖入哪个单元格.
| 归档时间: |
|
| 查看次数: |
1991 次 |
| 最近记录: |