“Microsoft.Xna.Framework.Color'和暧昧之间的参考; “System.Drawing中” [英] Ambiguous reference between 'Microsoft.Xna.Framework.Color' & 'System.Drawing'

查看:210
本文介绍了“Microsoft.Xna.Framework.Color'和暧昧之间的参考; “System.Drawing中”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这是一个简单的问题来回答,但我仍然无法找出一个办法让过去吧。

I think this is a simple question to answer, but I still can't figure out a way to get past it.

基本上,我想要的东西,在我的XNA游戏使用位图对象。于是我继续添加 System.Drawing中作为组件的参考。这个工作很完美,但我现在得到一个不同的错误; '色'是'Microsoft.Xna.Framework.Color'和'System.Drawing中'。我怎么过去的?

Basically, what I wanted, was to use a Bitmap object in my Xna game. So I went ahead and added System.Drawing as an assembly reference. This worked out perfectly, except that I now get a different error; "'Color' is an ambiguous reference between 'Microsoft.Xna.Framework.Color' and 'System.Drawing'. How do I get past this?

推荐答案

单独的集引用不会导致错误。这是使用,你可能已经插入,因为它导入了整个空间。你可以尝试

The assembly reference alone doesn't lead to the error. It's the using that you've probably inserted, because it imports the whole namespace. You could try

using Bitmap = System.Drawing.Bitmap

而不是只导入位图。

instead to import the bitmap only.

这篇关于“Microsoft.Xna.Framework.Color'和暧昧之间的参考; “System.Drawing中”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆