Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# GDI+;中发生一般性错误;在C中#_C# - Fatal编程技术网

C# GDI+;中发生一般性错误;在C中#

C# GDI+;中发生一般性错误;在C中#,c#,C#,我正在使用第三方控件从位图文件中读取条形码。下面是我的方法的代码 public void ShowBarcode(IntPtr img) { int nBarCode; SoftekBarcodeLib2.BarcodeReader barcode = new SoftekBarcodeLib2.BarcodeReader(); barcode.ReadCode39 = 1; barcode.ReadNumeric = 1;

我正在使用第三方控件从位图文件中读取条形码。下面是我的方法的代码

public void ShowBarcode(IntPtr img)
    {
        int nBarCode;
        SoftekBarcodeLib2.BarcodeReader barcode = new SoftekBarcodeLib2.BarcodeReader();
        barcode.ReadCode39 = 1;
        barcode.ReadNumeric = 1;
        nBarCode = barcode.ScanBarCodeFromBitmap(img);
        for (int i = 1; i <= nBarCode; i++)
        {
            MessageBox.Show(barcode.GetBarString(i));
        }

    }
public void ShowBarcode(IntPtr img)
{
int-nBarCode;
SoftekBarcodeLib2.BarcodeReader条形码=新的SoftekBarcodeLib2.BarcodeReader();
barcode.ReadCode39=1;
barcode.ReadNumeric=1;
nBarCode=条形码。ScanBarCodeFromBitmap(img);

对于(int i=1;i我在处理C#中的图像时收到了相同的错误消息。问题通常与权限有关。如果运行应用程序的帐户没有对文件系统中存储临时图像的位置的写入权限,您将收到提到的错误消息。

我将面临此错误所以我现在可以理解了 在上传img时的第一次强制转换中,必须关闭img的使用流,然后处理对象 在第二种情况下,他们好像没有关闭对象,但我面对它,因为我的服务器没有空间再次保存
希望这对你和其他人有所帮助

你从哪里获得参数
IntPtr img
???