C# 如何包含 System.Windows.Shapes?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/576622/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I include System.Windows.Shapes?
提问by Joe Fontana
I am using Visual Studio 2008 with the .NET Framework (v3.5). I cannot seem to use System.Windows.Shapes, or anything System.Windows.* besides Forms.
我将 Visual Studio 2008 与 .NET Framework (v3.5) 一起使用。我似乎无法使用 System.Windows.Shapes 或除 Forms 之外的任何 System.Windows.* 。
Here is the link to the class description:
这是类描述的链接:
System.Windows.Shapes (MSDN Library)
Is there some special thing I need to do to use it?
我需要做一些特殊的事情才能使用它吗?
I checked in all of the framework folders, and the only dll/xml files I have for System.Windows is System.Windows.Forms.
我检查了所有框架文件夹,System.Windows 唯一的 dll/xml 文件是 System.Windows.Forms。
What do I need to do to get this to work?
我需要做什么才能让它发挥作用?
采纳答案by Julien Roncaglia
回答by benPearce
You may need to add a reference to the library, probably System.Windows.Presentation
您可能需要添加对库的引用,可能是 System.Windows.Presentation
Edit: It is in the PresentationFrameworklibrary
编辑:它在PresentationFramework库中
回答by Zach Garner
You need to add a reference to the PresentationFramework library.
您需要添加对 PresentationFramework 库的引用。
In VisualStudio, right click on your project in the "Solution Explorer". Select "Add Reference". The "PresentationFramework" library will be under the ".NET" tab. You may also need to add "PresentationCore" and "WindowsBase".
在 VisualStudio 中,在“解决方案资源管理器”中右键单击您的项目。选择“添加引用”。“PresentationFramework”库将位于“.NET”选项卡下。您可能还需要添加“PresentationCore”和“WindowsBase”。
You can see your project's current library references by going to the "Solution Explorer" and expanding the "References" item.
您可以通过转到“解决方案资源管理器”并展开“引用”项来查看项目的当前库引用。
回答by sstauross
- Add reference to PresentationFramework from .Net tab
- write using System.Windows.Shapes
- 从 .Net 选项卡添加对 PresentationFramework 的引用
- 使用 System.Windows.Shapes 编写
and you are done!
你就完成了!
回答by elouadi abdelfattah
Other solution that works in .Net 4.0: Go to referenes->add reference and choose PrsentationFramework under .NET tab.
其他适用于 .Net 4.0 的解决方案:转到 referenes->add reference 并选择 .NET 选项卡下的 PresentationFramework。