如何在 "Button.image or pictureBox.ImageLocation" 中获取图标程序

how to get icon programs in "Button.image or pictureBox.ImageLocation"

我有问题,如何获取图标程序.exe 我有我创建的应用程序和我的应用程序 Process and kill 但是用户如何知道什么程序需要关闭或启动它。

方法是通过显示程序的图像,但是如何??

注意:有没有办法使用Path??示例:“C:\Users\NameUser\Desktop\Chrome.exe”GetIcon

enter image description here

我使用 visual studio windows 形式 C#

谢谢你的帮助

第一个回答 2 的代码不起作用 enter image description here

这对你有帮助吗?

var icon = Icon.ExtractAssociatedIcon(exeFilePath);

图片框可以使用

pictureBox.Image = Icon.ExtractAssociatedIcon(exeFilePath)?.ToBitmap();