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方法很少出问题。

 

posted @ 2012-01-10 10:34  Lance Yang  阅读(706)  评论(0编辑  收藏  举报