简体   繁体   English

在 wpf 应用程序的命名空间“System.Drawing”中找不到类型“Icon”

[英]The type 'Icon' could not be found in the namespace 'System.Drawing' in wpf application

I am making a Task Manager style application, and in it I would like to get icons for images and display them in a listview.我正在制作一个任务管理器风格的应用程序,我想在其中获取图像图标并将它们显示在列表视图中。 From my research, this seems possible with the Icon.ExtractAssociatedIcon function, passing a filename.根据我的研究,这似乎可以通过Icon.ExtractAssociatedIcon function 传递文件名。 However, I have run into an issue, whereby the module Icon doesn't seem to exist in System.Drawing.但是,我遇到了一个问题,即 System.Drawing 中似乎不存在模块 Icon。 I have found other questions similar to this that suggest adding the reference to the Visual Studio project, however this tab is just not available to me (the Assembly tab, see below).我发现了与此类似的其他问题,建议添加对 Visual Studio 项目的引用,但是此选项卡对我不可用(“程序集”选项卡,见下文)。 在此处输入图像描述 Does anyone know how to fix this issue?有谁知道如何解决这个问题? Thanks.谢谢。

From that screenshot it looks like you are using .NET 5. Dependencies are handled through the NuGet Package Manager.从该屏幕截图看来,您使用的是 .NET 5。依赖关系通过 NuGet Package 管理器处理。 You can right click on you project (Manage NuGet Packages...) search and install the System.Drawing.Common package.您可以右键单击您的项目(管理 NuGet 包...)搜索并安装System.Drawing.Common package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在控制台应用程序下找不到 System.drawing 命名空间 - System.drawing namespace not found under console application 错误 CS7069 对类型“图像”的引用声称它是在“System.Drawing”中定义的,但无法找到 - Error CS7069 Reference to type 'Image' claims it is defined in 'System.Drawing', but it could not be found 在.NET中看不到System.Drawing命名空间中的Image类型 - Cannot see the Image type in System.Drawing namespace in .NET WPF中的System.Drawing替代品? - System.Drawing alternative in wpf? System.Drawing命名空间中不存在Point - Point does not exist in namespace System.Drawing 无法从程序集“System.Drawing”加载类型“System.Drawing.Text.InstalledFontCollection” - Could not load type 'System.Drawing.Text.InstalledFontCollection' from assembly 'System.Drawing' System.Drawing和WPF互操作-CreateBitmapSourceFromHBitmap - System.Drawing and WPF Interop - CreateBitmapSourceFromHBitmap 无法在 C# 控制台应用程序中添加 System.Drawing 命名空间 - Can't add System.Drawing namespace in C# console application 位图未包含在 System.Drawing(控制台应用程序)中 - Bitmap not included in System.Drawing (Console Application) WPF滑块的RoutedPropertyChangedEventArgs-“找不到类型或名称空间” - RoutedPropertyChangedEventArgs for WPF slider - “type or namespace could not be found”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM