Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define single icon for main window and exe file?

Tags:

Usually I have to set 2 different icons. One in the project's settings tab, and one to the Icon property of main window. Is there a way to define single icon for the whole application (all windows and exe)?

Update: to be more concrete. I have app that is 100kb in size. I want to embed icon that is 300kb in size and want my app to be 400kb instead of 700

like image 914
Poma Avatar asked Apr 03 '11 17:04

Poma


People also ask

How do I assign an icon to a file?

1] Right-click the folder and select 'Properties' in the context menu. 2] Select 'Customize' and hit 'Change Icon' in the Properties window. 3] You can replace the folder icon with a basic/personalized icon. 4] Now click 'OK' to save the changes.

How do you add an icon to an exe with no icon?

click the select file button. Select your . ico file and press open, then you can name the icon resource to your choosing. Afterwards press 'Add Resource' this will add an icon to your exe file.


2 Answers

You need to set the icon in you project's properties:

enter image description here

For taskbar you need to change your main window's Icon: enter image description here

like image 139
Adi Avatar answered Sep 28 '22 08:09

Adi


When you set your exe icon, WPF will use that for all Windows you create. However, it doesn't do it in debug mode - that's because the "entry point" for your process is the .vshost.exe, not your exe. But if you use Ctrl+F5 (run without debugging), you should find all Windows get the exe icon. You shouldn't have to set it on each Window.

To make it work properly in debug mode, I generally set up a Style which I apply to each window, which sets the application icon.

like image 24
Paul Stovell Avatar answered Sep 28 '22 08:09

Paul Stovell