none
How do I edit a .ico? RRS feed

  • Question

  • I have created and edited .ico's in the past.  With VS 2019, I don't see that capability.

    Double clicking the .ico displays that .ico on the screen.  What additional step is required to edit that .ico?


    bhs67

    Sunday, November 17, 2019 12:46 PM

Answers

  • Hi bhs67,

    Thank you for the feedback.

    I’m not sure which kind of project do you use, I use WPF in my side and for example, I just create a new folder called “Resource” than right-click WPF project, point to Add and then select Existing Item… In the Add Existing Item dialog box, select the icon file and add it to Resource folder. I just insert this codes line:

    <Image Source="Resource/icon.ico" Width="20" Height="20" />

    to the XAML file and I could use this .ico file in MainWindow. (You could refer to this document How to: Assign an Image to an Image Control)

    I noticed that you said “add reference”, it seems no need to add some references. Maybe I misunderstand you.

    In addition, I also checked my project folder but the .ico file is just located in the Resource folder I created. I consider maybe you set “Copy to Output Directory” to “Copy if newer” or “Copy always” instead of “Do not copy”, and you could check the properties of the icon and if the “Build Action” is “Resource” like the screenshot below.

    Any feedback will be expected.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, November 19, 2019 7:46 AM

All replies

  • I would glimp to edit the icons it is free.

    https://www.gimp.org/

    Sunday, November 17, 2019 1:16 PM
  • They don't make it obvious, but it's still doable.

    1. Make sure you have a Resources.resx file added under Properties of your project

    2. Double click it and then "Add Resource", "Add new Icon"

    3. You'll get a bunch of defaults, but you have to delete them one by one (right click each and "remove image type"

    4. Then right click the list area again and "Add new image type", select the size you want

    5. Copy your image from MS Paint or whatever and paste into the new empty icon

    6. Rinse and repeat for the other sizes (delete existing, create new empty, rescale in Paint, copy, paste)

     

    All the best,
    Pete


    #PEJL
    Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

    Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!

    Sunday, November 17, 2019 3:34 PM
    Moderator
  • I forgot to say, if you want to do it all in VS, open the image and then click the "Image" menu option. Then select the "Tools" submenu. From there you can use the features to edit images.

     

    I agree with Ken though, Gimp is a well established free alternative which is vastly superior and gets the job done quicker. Microsoft has always had to juggle the need for basic tooling with not wanting to damage the developer community who are at the root of their success (RIP Windows Movie Maker, MS Money, etc). Sometimes frustrating, but we love them for that. So you'll get just enough to get the job done, if you have no alternative. 

     

    Regards,
    Pete

     


    #PEJL
    Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

    Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!



    Sunday, November 17, 2019 4:02 PM
    Moderator
  • I should have been more specific. 

    I've updated old code.  I want to use the same .ico, with a minor modification. 

    I copied the old .ico to \Resources.  Then => Project -> Add Reference -> Solution -> Browse to .dll.  (The .ico appears in Solution Explorer as a Resource)

    When I compile and run, everything looks fine.

    Now I want to modify the old .ico.  I double click the old .ico => it appears on the screen.  I modify the old .ico on the screen (I've been using the tool bar icons instead of menu items). 

    I save and compile => the old icon still displays. 

    Using Windows Explorer, the new icon is in the Resources folder.  But the old icon is still in my project folder.

    What is the correct procedure?  Thanks!

    bhs67

    Sunday, November 17, 2019 5:22 PM
  • Hi bhs67,

    Welcome to MSDN forum.

    According to your description, I follow your steps and test in my side, but seems it works well. I first create a .ico icon then create a new project, copy it to Resources folder and add this existing item(.ico) to Resources folder from Solution Explorer. Edit this icon and save then rebuild solution, then go to Resources folder and find the icon has been updated to the newest icon that I modified just a moment ago.

    Not sure which kind of project do you use, for me I test with classlibrary and WPF but all works well. I also use Image Editor toolbar like you said.

    However, I notice when I Undo some modifications on the icon, and save then build, it seems the icon are still keep old version. But I didn’t encounter the condition you mentioned above(the new icon is in the Resource folder, but the old icon is still in my project folder). I just get only one icon every time I modify and save then build.

    I shared a gif of what I did with you and if I miss something, please feel free to let me know.

    We are looking forward to hearing from you.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 18, 2019 7:39 AM
  • I had used the old .ico for a few weeks.  When I modified that .ico, VS kept using the old .ico. 

    I deleted the entire project to avoid clutter (I had made a copy before I tried changing the .ico).  I'll try again.

    I'm curious about the location of the .ico.  Initially I put it in the Resources folder.  Later it also appears in the project folder (probably after Project -> Add Reference).  Which one is VS using?  Should I copy the .ico in the Resources folder to the project folder?  (The .ico has the same name.)


    bhs67


    • Edited by bhs67 Monday, November 18, 2019 12:44 PM
    Monday, November 18, 2019 12:43 PM
  • Hi bhs67,

    Thank you for the feedback.

    I’m not sure which kind of project do you use, I use WPF in my side and for example, I just create a new folder called “Resource” than right-click WPF project, point to Add and then select Existing Item… In the Add Existing Item dialog box, select the icon file and add it to Resource folder. I just insert this codes line:

    <Image Source="Resource/icon.ico" Width="20" Height="20" />

    to the XAML file and I could use this .ico file in MainWindow. (You could refer to this document How to: Assign an Image to an Image Control)

    I noticed that you said “add reference”, it seems no need to add some references. Maybe I misunderstand you.

    In addition, I also checked my project folder but the .ico file is just located in the Resource folder I created. I consider maybe you set “Copy to Output Directory” to “Copy if newer” or “Copy always” instead of “Do not copy”, and you could check the properties of the icon and if the “Build Action” is “Resource” like the screenshot below.

    Any feedback will be expected.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, November 19, 2019 7:46 AM
  • I'm using WPF. 

    I don't recall the exact sequence, so I decided to start over with a new project.  I create a project --- File => New => Project => WPF App (.NET Framework). 

    In the past (older VS versions, maybe 20 years ago), a Resources folder was part of this sequence.  I see now that no longer occurs (Resources used to appear in the Solution Explorer).

    I "right click" project => Properties => Application => Icon and manifest => Browse => x.ico => compile.  That x.ico appears on my project folder and displays on my dialog box when I run it.

    I modified x.ico and it works now! 

    This is one hazard of loading old code and modifying it.  In this case, I wrote the original code with C using DOS.  It's gone thru quite a few updates!

    Sorry to bother you.


    bhs67

    Tuesday, November 19, 2019 12:39 PM