【问题标题】:Create Image or Bitmap in console application - can't seem to find System.Drawing?在控制台应用程序中创建图像或位图 - 似乎找不到 System.Drawing?
【发布时间】:2012-11-26 21:34:19
【问题描述】:

我正在尝试从相机比特流创建图像或位图,我将(希望)通过 websocket 将其传递给浏览器。我正在构建的应用程序是一个控制台应用程序,因为我认为这个应用程序不需要 GUI。现在我无法创建/访问 Image 和 Bitmap 类 - System.Drawing 似乎不存在,我不知道为什么。当我尝试using System.Drawing 时,我收到错误The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?) 在控制台应用程序中创建位图的最佳方法是什么,我似乎无法加载 System.Drawing 是否有原因?

代码:

private void Kinect_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
{
    using (ColorImageFrame frame = e.OpenColorImageFrame())
    {
        if (frame != null)
        {
            byte[] pixelData = new byte[frame.PixelDataLength];
            frame.CopyPixelDataTo(pixelData);
            //how do we create a bitmap here and pass it off to chrome?

        }
    }
}

【问题讨论】:

  • 您的项目中是否引用了适当的程序集?

标签: c# bitmap console-application


【解决方案1】:

您必须在项目中添加对 system.Drawing.Dll 的引用。

右键Project,添加引用,找到System.Drawing.DLL,添加引用。

编辑: 您将在 Assemblies->Framework->System.Drawing 下找到它

【讨论】:

  • 啊,真可惜,它燃烧了。谢谢。
【解决方案2】:

将 System.Drawing.dll 作为参考程序集添加到您的项目中。

【讨论】:

  • 知道这很明显。谢谢。
【解决方案3】:

在引用中包含 System.Drawing.dll 1)您可以从http://www.dllme.com/dll/download/7139/System.Drawing.dll下载它

【讨论】:

    猜你喜欢
    • 2012-01-23
    • 1970-01-01
    • 2011-12-01
    • 2016-02-05
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多