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
基础教程推荐
- 如果条件可以为空 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
