Rob*_*cks 11 c# icons winforms
我已使用"项目属性"选项卡为C#WinForms应用程序分配了一个图标.此图标与构建时的程序清单一起提供.有没有办法System.Drawing.Icon在运行时获取此图标的对象,而无需再次将其嵌入资源?
我做了我的研究; 有一种方法可以从EXE中提取一个图标,但是我无法从应用程序中找到从正在运行的C#应用程序中提取图标的任何内容.
Wya*_*arp 20
你看到链接中的第二个答案了吗?(如何从可执行文件中获取图标只有C#中的进程实例)
//Gets the icon associated with the currently executing assembly
//(or pass a different file path and name for a different executable)
Icon appIcon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
Run Code Online (Sandbox Code Playgroud)
这似乎是获得执行程序集的图标.