微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决抛出异常: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 举报,一经查实,本站将立刻删除。