I need to change the icon in the application I am working on. But simply browsing for other icons from the project property tab -> Application -> Icon, it is not getting the icons stored on the desktop..
What is the right way of doing it?
I need to change the icon in the application I am working on. But simply browsing for other icons from the project property tab -> Application -> Icon, it is not getting the icons stored on the desktop..
What is the right way of doing it?
The icons you are seeing on desktop is not a icon file. They are either executable files .exe or shortcuts of any application .lnk. So can only set icon which have .ico extension.
Go to Project Menu -> Your_Project_Name Properties -> Application TAB -> Resources -> Icon
browse for your Icon, remember it must have .ico extension
You can make your icon in Visual Studio
Go to Project Menu -> Add New Item -> Icon File
The Icon displayed in the Taskbar and Windowtitle is that of the main Form. By changing its Icon you also set the Icon shown in the Taskbar, when already included in your *.resx:
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typeof(MyForm));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("statusnormal.Icon")));
or, by directly reading from your Resources:
this.Icon = new Icon("Resources/statusnormal.ico");
If you cannot immediately find the code of the Form
, search your whole project (CTRL+SHIFT+F
) for the shown Window-Title (presuming that the text is static)
You can change the app icon under project properties. Individual form icons under form properties.
Once the icon is in a .ICO format in visual studio I use
//This uses the file u give it to make an icon.
Icon icon = Icon.ExtractAssociatedIcon(String);//pulls icon from .ico and makes it then icon object.
//Assign icon to the icon property of the form
this.Icon = icon;
so in short
Icon icon = Icon.ExtractAssociatedIcon("FILE/Path");
this.Icon = icon;
Works everytime.
Add your icon as a Resource (Project > yourprojectname Properties > Resources > Pick "Icons from dropdown > Add Resource (or choose Add Existing File from dropdown if you already have the .ico)
Then:
this.Icon = Properties.Resources.youriconname;
On the solution explorer, right click on the project title and select the 'Properties' on the context menu to open the 'Project Property' form. In the 'Application' tab, on the 'Resources' group box there is a entry field where you can select the icon file you want for your application.
I added the .ico file to my project, setting the Build Action to Embedded Resource. I specified the path to that file as the project's icon in the project settings, and then I used the code below in the form's constructor to share it. This way, I don't need to maintain a resources file anywhere with copies of the icon. All I need to do to update it is to replace the file.
var exe = System.Reflection.Assembly.GetExecutingAssembly();
var iconStream = exe.GetManifestResourceStream("Namespace.IconName.ico");
if (iconStream != null) Icon = new Icon(iconStream);
I found that the easiest way is:
In the Main Form Load function:
Icon = LoadIcon("< the file name of that icon file >");
The Simplest solution is here: If you are using Visual Studio, from the Solution Explorer
, right click on your project file. Choose Properties
. Select Icon and manifest
then Browse your .ico
file.
Select your project properties from Project Tab Then Application->Resource->Icon And Manifest->change the default icon
This works in Visual studio 2019 finely Note:Only files with .ico format can be added as icon