Can#39;t find System.Windows.Vector in C#(在 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.
问题可能是:在 Vector29.aspx" rel="noreferrer">System.Windows
命名空间,还有Rect
或Application
等其他类.我可以将它们用作 System.Drawing.Rectangle
或 System.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 C# 中找不到 System.Windows.Vector
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01