0
using System;
using System.Drawing;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
namespace FlyCapture2Managed
{
public class ManagedImage : IDisposable
{
    public ManagedImage();
    public ManagedImage(ManagedImage image);
    public ManagedImage(byte* pData, uint dataSize);
    public ManagedImage(uint rows, uint cols, PixelFormat format);
    public ManagedImage(uint rows, uint cols, PixelFormat format, BayerTileFormat bayerFormat);
    public ManagedImage(uint rows, uint cols, uint stride, byte* pData, uint dataSize, PixelFormat format);
    public ManagedImage(uint rows, uint cols, uint stride, byte* pData, uint dataSize, PixelFormat format, BayerTileFormat bayerFormat);
    public ManagedImage(uint rows, uint cols, uint stride, byte* pData, uint dataSize, uint receivedActualSize, PixelFormat format);
    public ManagedImage(uint rows, uint cols, uint stride, byte* pData, uint dataSize, uint receivedActualSize, PixelFormat format, BayerTileFormat
  }

那是原始代码。我正在努力完成这项工作

 using System;
 using System.Drawing;
 using System.Runtime.ExceptionServices;
 using System.Runtime.InteropServices;
 namespace FlyCapture2Managed2
 {
  public struct ManagedImage2 : IDisposable
  {
public ManagedImage2();
public ManagedImage2(ManagedImage image);
public ManagedImage2(byte* pData, uint dataSize);
public ManagedImage2(uint rows, uint cols, PixelFormat format);
public ManagedImage2(uint rows, uint cols, PixelFormat format, BayerTileFormat bayerFormat);
public ManagedImage2(uint rows, uint cols, uint stride, byte* pData, uint dataSize, PixelFormat format);
public ManagedImage2(uint rows, uint cols, uint stride, byte* pData, uint dataSize, PixelFormat format, BayerTileFormat bayerFormat);
public ManagedImage2(uint rows, uint cols, uint stride, byte* pData, uint dataSize, uint receivedActualSize, PixelFormat format);
public ManagedImage2(uint rows, uint cols, uint stride, byte* pData, uint dataSize, uint receivedActualSize, PixelFormat format, BayerTileFormat
  }
  public class managed
    {
    [DllImport(@"S:\FlyCapture2SimpleGUI_CSharp\bin\x64\Debug\FlyCapture2Managedd_v100.dll",  CallingConvention = CallingConvention.Cdecl)]

    static extern void managed();  
}

我不断收到有关错误的错误

The type or namespace name 'PixelFormat' could not be found (are you missing a 
using directive or an assembly reference?). The Pixelformat in this case is part of the name space "flycapture" and not System.Drawing.imaging namepspace

但是我不想使用引用,因为我更喜欢在我的工作中引用这段代码。

问候

4

1 回答 1

0

PixelFormat枚举是命名空间的一部分,System.Drawing.Imaging所以你应该在文件顶部添加这个 using 指令:

using System.Drawing.Imaging;
于 2013-07-28T14:34:43.663 回答