抛出异常:System.Drawing.dll 中的“System.ArgumentException”

问题描述

Exception thrown: 'System.ArgumentException' in System.Drawing.dll

我使用网络摄像头获取位图图像并生成二维码。然后将其传入“QRLiveBox”的图片框。

但是在调试时这段特定的代码出现了错误

Result result = barcodeReader.Decode(new Bitmap(QRLiveBox.Image as Bitmap));

if (QRLiveBox.Image != null)
{
   BarcodeReader barcodeReader = new BarcodeReader();
   //Result result = barcodeReader.Decode((Bitmap)QRLiveBox.Image);

   Result result = barcodeReader.Decode(new Bitmap(QRLiveBox.Image as Bitmap));

   if (result != null)
   {
      string qrResult = result.ToString();
      txtDecodedQRCode.Text = qrResult;


      //captureDevice.Stop();
   }
}

你们认为问题或解决方案。以及如何编码。

  1. 两个线程是否不能同时访问位图?
  2. 是不是接口有问题?
  3. 如何在不使用 Control.Invoke 的情况下访问任何控件?

在这里找到了线索:

  1. Best Way to Invoke Any Cross-Threaded Code?
  2. InvalidOperationException - object is currently in use elsewhere

但我不知道如何在我的项目中实现它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)