c# - 引用中的 wp8 :Cannot find System. Drawing.dll

标签 c# .net windows-phone-8

我遇到了一个奇怪的问题。我正在使用适用于 Windows Phone 8 的 Visual Studio 2012 Express,并且想要引用 System.Drawing.dll。我右键单击项目中的“引用”,然后单击“添加引用...”,但是,我在.NET选项卡下找不到System.Drawing.dll。有什么想法吗?

实际上我想将我的图像转换为 base64 。我有一种方法,该方法包含 Sysytem.drawing成像.dll。

public string imagetobase64(image image,
  system.drawing.imaging.imageformat format)
{
    using (memorystream ms = new memorystream())
    {
        // convert image to byte[]
        image.save(ms, format);
        byte[] imagebytes = ms.toarray();

        // convert byte[] to base64 string
        string base64string = convert.tobase64string(imagebytes);
        return base64string;
    }
}

Convert image to base64 string 。我该如何解决这个问题?

最佳答案

(在问题改为实际问两个问题之前回答...)

Any ideas why?

是的 - 您根本无法在 Windows Phone 8 中使用 System.Drawing.dll

看看list of supported .NET namespaces in Windows Phone 8 - System.Drawing 不存在,并且 System.Drawing.dll 中的所有公共(public)类型都在 System.Drawing 命名空间中(或者无论如何,以 System.Drawing 开头)。

您还没有说出您实际上想要实现的目标,但您只需要找到其他方法即可实现。

关于c# - 引用中的 wp8 :Cannot find System. Drawing.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16272229/

相关文章:

windows-phone-7 - 在 Windows 模拟器中安装 .xap 文件

windows-phone-7 - 在 Windows Phone 8 中,我不断收到 System.WIndows.Markup.XamlParseException

c# - 在 C# 中进行游戏开发需要使用什么?

C# MongoDb FindAndUpdate(很多)

c# - 测试 PSObject 是否源自 WriteObject() WriteWarning() WriteError()

c# - 如何在没有循环的情况下将键数组和值数组连接到字典中?

c# - 通过 Web 服务自动公开数据库表

video - 类似于 Viber/WhatsApp 的 Windows Phone 8 媒体选择器(照片和视频)

c# - VS2005 库

c# - 在 NHibernate 中管理 session 的最佳方式?