在 C# 中找不到 System.Windows.Vector [英] Can't find System.Windows.Vector in C#

查看:32
本文介绍了在 C# 中找不到 System.Windows.Vector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Visual Studio 2010 Ultimate 中制作 Windows 窗体应用程序,但无法让内置 Vector 工作.

I'm making a Windows Forms application in Visual Studio 2010 Ultimate, but can't get the built-in Vector to work.

微软说有一个 System.Windows.NET Framework 4 中的.Vector:

Microsoft says that there is a System.Windows.Vector in the .NET Framework 4:

也许我犯了一些大错误,但 Visual Studio 抱怨尝试以任何方式使用 Vector,并且它不会出现在 IntelliSense 自动完成中:

Maybe I'm making some large mistake, but Visual Studio complains about trying to use Vector in any way, and it doesn't come up in the IntelliSense autocomplete:

Vector v = new Vector(20, 30); 行给出了

编译错误 错误 1 ​​找不到类型或命名空间名称Vector"(您是否缺少 using 指令或程序集引用?)"

Compile error Error 1 The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?)"

我尝试在顶部包含 using System.Windows 但这并没有解决问题.

I tried including a using System.Windows at the top but that didn't solve the problem.

我去了 References -> Add Reference 试图找到要添加的东西,但没有什么明显的.

I went to References -> Add Reference to try to find something to add, but nothing was obvious.

问题可能是:在 System.Windows命名空间,还有RectApplication等其他类.我可以将它们用作 System.Drawing.RectangleSystem.Windows.Forms.Application,但 这些都不会作为某些 System.Windows 命名空间的一部分出现

The problem may be: Also listed with Vector in the System.Windows namespace, there are other classes like Rect or Application. I could use these as System.Drawing.Rectangle or System.Windows.Forms.Application, but none of these show up as part of some System.Windows namespace

我尝试了大约 2 个小时的不同事情,发现 this related post(但 Vector .NET 4 的一部分,所以他们的修复似乎不值得?)和 这个可能相关的帖子 但我确实有已安装 .NET Framework 4.

I've tried different things for about 2 hours, and found this related post (but Vector is part of .NET 4, so their fix doesn't seem worthwhile?) and this possibly related post but I do have .NET Framework 4 installed.

有人有Vector的例子吗?我知道我可以参加第三方课程,但我觉得我遗漏了一些东西,并且想学习/发布解决方案,以便其他人在谷歌上搜索同样的问题.

Does anyone have an example of Vector? I know I could get a third party class, but I feel I'm missing something, and want to learn/have the solution posted for other people googling the same problem.

推荐答案

添加对 WindowsBase 的引用.
Vector 类在 System.Windows 命名空间内的 WindowsBase.dll 程序集中定义.

Add a reference to WindowsBase.
The Vector class is defined in the WindowsBase.dll assembly within the System.Windows namespace.

这篇关于在 C# 中找不到 System.Windows.Vector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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