Drag-and-Drop multiple Attached File From Outlook to C# Window Form

Я использую следующий код для перетаскивания одного файла.

 private void FormRegion2_DragEnter_1(object sender, DragEventArgs e)
    {
        if (e.Data.GetDataPresent(DataFormats.FileDrop))
        { e.Effect = DragDropEffects.Copy; }
        //    or this tells us if it is an Outlook attachment drop
        else if (e.Data.GetDataPresent("FileGroupDescriptor"))
        { e.Effect = DragDropEffects.Copy; }
        //    or none of the above
        else
        { e.Effect = DragDropEffects.None; }
    }

  private void FormRegion2_DragDrop_1(object sender, DragEventArgs e)
    {
        string[] fileNames = null;


        if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true)
        {
            fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);                
            foreach (string fileName in fileNames)
            {
            }
        }
        else if (e.Data.GetDataPresent("FileGroupDescriptor"))
        {
           object s = e.Data.GetData("FileGroupDescriptor");

            Stream theStream = (Stream)e.Data.GetData("FileGroupDescriptor");
            byte[] fileGroupDescriptor = new byte[512];
            theStream.Read(fileGroupDescriptor, 0, 512);

            StringBuilder fileName = new StringBuilder("");

            for (int i = 76; fileGroupDescriptor[i] != 0; i++)
            { fileName.Append(Convert.ToChar(fileGroupDescriptor[i])); }

            string theFile = fileName.ToString();             
            String fileName1 = System.IO.Path.GetFileName(theFile);                

        }

    }

Моя проблема в том, что я не могу получить имя нескольких файлов. Как можно получить несколько имен файлов

Thx

10
задан V_B 3 January 2012 в 07:21
поделиться