码迷,mamicode.com
首页 > Windows程序 > 详细

WPF 拖动多个文件到窗体 添加文件信息

时间:2016-05-13 08:40:45      阅读:399      评论:0      收藏:0      [点我收藏+]

标签:

将WindowAllowDrop属性设置为true

window添加Drop事件

 

private void Window_Drop(object sender, DragEventArgs e)
        {

     string dropFile = "Drop";
            if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
            {
                int count = ((System.Array)e.Data.GetData(System.Windows.DataFormats.FileDrop)).Length;
                for (int i = 0; i < count; i++)
                {
                    dropFile = ((System.Array)e.Data.GetData(System.Windows.DataFormats.FileDrop)).GetValue(i).ToString(); ;
                    MessageBox.Show(dropFile);
                }
            }
        }

 

       

WPF 拖动多个文件到窗体 添加文件信息

标签:

原文地址:http://www.cnblogs.com/duan425/p/5485070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!