gpt4 book ai didi

c# - 在 C# 中找不到 System.Windows.Vector

转载 作者:可可西里 更新时间:2023-11-01 08:03:34 26 4
gpt4 key购买 nike

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

Microsoft 说有一个 System.Windows.Vector在 .NET Framework 4 中:

也许我犯了一些大错误,但 Visual Studio 提示试图以任何方式使用 Vector,并且它没有出现在 IntelliSense 自动完成中:

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

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 但这并没有解决问题。

我去 References -> Add Reference 试图找到要添加的东西,但没有什么是显而易见的。

问题可能是:在 System.Windows 中也列出了 Vector命名空间,还有其他类,如 RectApplication。我可以将它们用作 System.Drawing.RectangleSystem.Windows.Forms.Application,但这些都不显示为某些 System.Windows 命名空间的一部分

我已经尝试了大约 2 个小时的不同方法,并找到了 this related post (但是 Vector .NET 4 的一部分,所以他们的修复似乎不值得?)和 this possibly related post但我确实安装了 .NET Framework 4。

有没有人有Vector的例子?我知道我可以获得第三方类(class),但我觉得我错过了一些东西,并且想学习/发布解决方案以供其他人使用 google 搜索相同的问题。

最佳答案

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

关于c# - 在 C# 中找不到 System.Windows.Vector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6142690/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com