Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a simple C# application (.net 4.7.2 windows application)

I/we need to create 3 versions of this application each with its own application icon.

MyApp.exe -> a.ico
MyApp.exe -> b.ico
MyApp.exe -> c.ico


I know how to add the icon for one instance (application properties)


I'm not certain what would be the best approach to have the 3 application each with its own icon.

Thanks for pointing me in the right direction.

What I have tried:

I don't know what to try or what to search for.
Posted
Updated 18-May-21 23:14pm
Comments
PIEBALDconsult 18-May-21 10:31am    
Why? I see no benefit of doing that.

Set it at runtime, when you decide "which instance" this run is:
C#
public MyForm()
    {
    InitializeComponent();
    using (FileStream fs = File.OpenRead("App3.ico"))
        {
        Icon = new Icon(fs);
        }
    }
 
Share this answer
 
Hello,
Why not add an argument when starting (a, or c) the application and handle the argument in application initialization.
 
Share this answer
 
Window icon or application icon?
If you want to switch between different window icons according to different versions, you can add all the icons to the resources of the project.
C#
if(/*add your code*/){
    this.Icon = Properties.Resources.a_ico
}else if(/*add your code*/){
    this.Icon = Properties.Resources.b_ico
}else{
    this.Icon = Properties.Resources.c_ico
}
 
Share this answer
 
A simple way would be to use a batch file that replaces the icon and builds the application three times.
You can also load another icon for a form at startup, but this does not change the application icon that you see in explorer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900