在我的c#Win Form应用程序中,我正在使用拖放功能。用户应该拖放文件夹,我的应用程序会检查文件夹是否存在。一位用户尝试拖放链接/ shotcut并收到错误消息。如果它是文件夹,文件或链接,它给我一个检查被删除对象的想法。
这是我的代码:
void Form1_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
TB_folder.Text = files[0].Trim();
if (Directory.Exists(TB_folder.Text) != true)
.................
有没有办法检查“DragEventArgs e”是文件,链接还是文件夹?
谢谢,
ZB