如何获得被拖拉文件的路径? 在拖拉事件中,怎么获取被拖拉文件的路径信息? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void OnLocalListViewDrapDrop(object sender, DragEventArgs e) { try { string[] formats = e.Data.GetFormats(); if (formats != null && formats.Length > 0) { foreach (string fmt in formats) { if (fmt == "FileNameW") { string[] fileNames = e.Data.GetData(fmt) as string[]; if (fileNames != null && fileNames.Length > 0) { foreach (string fileName in fileNames) { if (!string.IsNullOrEmpty(fileName)) { if (File.Exists(fileName)) { FileSystem.CopyFile(fileName, Path.Combine(explorerTreeView.SelectedNode.Path, Path.GetFileName(fileName)), UIOption.AllDialogs, UICancelOption.DoNothing); } if (Directory.Exists(fileName)) { FileSystem.CopyDirectory(fileName, explorerTreeView.SelectedNode.Path, UIOption.AllDialogs, UICancelOption.DoNothing); } } } break; } } } } } catch { } } FileSystem? 不懂?请教 就是1楼说的方法FileSystem是1楼封装的文件各种操作方法的类楼主可以按照1楼来做 using Microsoft.VisualBasic.FileIO;FileSystem是VB下的IO封装,比较强大 c# 未将对象引用设置到对象的实例 关于截取字符串 用C#如何从webbrowser的table中提取出某一列的值 adapter.Update()违反并发性 Math.Sin/ Math.Tan/Math.Cos 是什么意思 小弟刚刚学JAVA 不知道!学什么对java web有帮助 关于一个控件数组的作用范围问题~! 怎么回事?自从csdn改版后,我的可用分一直是0? 老大们--帮忙处理修改AD用户密码问题 checkedlistbox 控件怎么用??? 怎么快速输入反引号 求教:C#关于事件
void OnLocalListViewDrapDrop(object sender, DragEventArgs e)
{
try
{
string[] formats = e.Data.GetFormats(); if (formats != null && formats.Length > 0)
{
foreach (string fmt in formats)
{
if (fmt == "FileNameW")
{
string[] fileNames = e.Data.GetData(fmt) as string[];
if (fileNames != null && fileNames.Length > 0)
{
foreach (string fileName in fileNames)
{
if (!string.IsNullOrEmpty(fileName))
{
if (File.Exists(fileName))
{
FileSystem.CopyFile(fileName,
Path.Combine(explorerTreeView.SelectedNode.Path,
Path.GetFileName(fileName)),
UIOption.AllDialogs, UICancelOption.DoNothing);
}
if (Directory.Exists(fileName))
{
FileSystem.CopyDirectory(fileName, explorerTreeView.SelectedNode.Path,
UIOption.AllDialogs, UICancelOption.DoNothing);
}
}
}
break;
}
}
}
}
}
catch
{
}
}
不懂?请教
FileSystem是1楼封装的文件各种操作方法的类
楼主可以按照1楼来做
using Microsoft.VisualBasic.FileIO;FileSystem是VB下的IO封装,比较强大