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
但是我不想使用引用,因为我更喜欢在我的工作中引用这段代码。
此致
答案 0 :(得分:0)
PixelFormat
枚举是System.Drawing.Imaging
命名空间的一部分,因此您应该在文件顶部添加此using指令:
using System.Drawing.Imaging;