首页 > Windows开发 > 详细

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

时间:2016-05-13 08:40:17      阅读:201      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!