winform文件拖入

 

//view.AllowDrop = true;

----------------------------------------
private void view_DragEnter(DragEventArgs drgevent)
{
if (m_allowdrop)
{
if (drgevent.Data.GetDataPresent(DataFormats.FileDrop))
{
drgevent.Effect = DragDropEffects.Link;
}
else
{
drgevent.Effect = DragDropEffects.None;
}
}
}

private void view_DragDrop(DragEventArgs drgevent)
{
Array arrayFileName = drgevent.Data.GetData(DataFormats.FileDrop) as Array;
if (arrayFileName != null)
{
foreach (string name in arrayFileName)
{
//AddFileNameCtl(name);
}
}
}

  

posted on 2015-03-20 21:40  飞舞的蒲公英  阅读(195)  评论(0编辑  收藏  举报