Drag and drop from Windows File Explorer onto a Windows Form is not working

后端 未结 4 1754
一生所求
一生所求 2021-02-09 01:41

I\'m having an issue dragging a file from Windows Explorer on to a Windows Forms application.

It works fine when I drag text, but for some reason it is not recognizing

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 02:40

    Did you try to add the STAThread attribute to the main method?

      [STAThread]
      static void Main(string[] args)
      {
      }
    

    I had the same problem as @mattruma meaning i got not Drag&Drop events. After adding the STAThread attribute to the main method it worked as expected.

提交回复
热议问题