[英]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.