Set System Icon as Project Icon

299 Views Asked by At

I want to set the project icon (the one that goes in the manifest and represents the EXE compiled as it's icon) from the Shell32.dll icon library.

I found this article on StackOverflow about "How can I use the images within shell32.dll in my C# project?" but it only shows how to load the icon as a Form Icon. I'd like to have it as the project icon, once it compiles. Reference even, instead of embeded as resource (if possible).

So my question is: is it possible to do?

1

There are 1 best solutions below

4
Fabo.sk On

The main form is still a form and can be manipulated in the same way.

Assuming you use the IconExtractor class from the article you link to, you can do something like this:

public partial class Main : Form
{
    private Icon extractedIcon;

    public Main()
    {
        extractedIcon= IconExtractor.Extract("shell32.dll", 24, true);
        InitializeComponent();
        this.Icon = extractedIcon;
    }
}