DragDrop registration did not succeed. (摘录)

You've been tinkering with threading.  Drag+Drop doesn't like threads.  It will only work on threads that are properly initialized with Thread.SetApartmentState() to select STA and that pump a message loop with Application.Run() or Form.ShowDialog().

1、加[STAThread]

2、Thread t = new Thread(new ThreadStart(A));
   t.SetApartmentState(ApartmentState.STA);
   t.Start( );

   并不能加[STAThread]

有时加[STAThread]这个都会出现问题,不知道是不是Application.Run()上没有做好,但用2方法很少出问题。

 

你可能感兴趣的:(drag)