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
???