InvalidOperationException - object is currently in use elsewhere

前端 未结 4 1216
再見小時候
再見小時候 2020-11-28 13:25

I\'ve gone through this SO question but it didn\'t help.

The case here is different. I\'m using Backgroundworkers. 1st backgroundworker starts operating on the image

4条回答
  •  星月不相逢
    2020-11-28 14:04

    When I tried to access the main thread component (PictureBox) from different threads, I had also System.InvalidOperationException: Object is currently in use

    MethodInvoker Delegate solved the problem.

    Invoke((MethodInvoker)(delegate ()
    {
       var image = PictureBox.Image;
    }));
    

提交回复
热议问题