locked
Completely confused - .ico .bmp nightmares RRS feed

  • Question

  • Ok we have a sophisticated app, and it works fine, lot of code, so we know how to develop but....

     

    Since the start, the issue of icons and toolbar button images has been a drag, we have muddled thorugh with an "It'll do for now" attitude and this has been OK, I mean functionally were fine.

     

    I am now completely confused, by the Forms Designer, by icons/bitmaps, transparency, alpha-channels etc.

     

    All I ever wanted to do was use a library of various Windows icon files for

     

    1. TreeView (small)

    2. ListView (large/small icons)

    3. Toolbar buttons (small)

     

    It started off with the assumption that I could use a .ico file (that contained a 16x16 image at least) as the source for a toolbar button image, but this is immensely confusing now, it seems that one MUST only use .bmp files for toolbar buttons, but I am  not sure. Why cant I simply use .ico file in my project and have VS 2005 "understand" these?

     

    (Is there not some way of creating two app-wide image lists in the designer, and then have EVERYTHING refer to these?)

     

    There is also the issue of resources, these have become a mess (we have a project resource file full of mixed up ico and bm files and several form level resources).

     

    Adding to the confusion, is the fact that the various window controls (tree, image list, toolbars etc) refer to Image or Icon objects and these are created (automatically???) when we add .ico files etc to the project.

     

    I have now completely lost all understanding, because I opened a .ico file (that has several folder images, various sizes and various color resolutions) exported the 16x16 32-bit color image to a .bmp file.

     

    I then added that as a resource and then set a toolbar button to be this image - it has a dark surround, clearly something to do with transparency or alpha channel etc.

     

    Even worse, if I attempt to specify a .ico file as image source for a toolbar button, it gets crazy and IDE designer can even fail.

     

    So is there a book or detailed article that explains how one can (in VS 2005 for XP/Vista)

     

    1. Setup resources for the above usage

    2. Create the needed .bmp from .ico

    3. Avoid the hassle of fiddling with background/transparency etc

    4. Help us set up a simple working policy for managing this with less effort.

     

    ?

     

    I'd love to remove all icons/images from the project and do all this part again, neatly and simply.

     

    It's a mess and my attempts to simplify and tidy up fail becaue the whole issue is poorl explained in ALL the .NET books I have (even all the WinForms books just gloss over this).

     

    Any guidance, pointers or books that REALLY delve deeply into this apsect of .NET development will be greatly appreciated.

     

    Thx

    H

    Tuesday, April 17, 2007 2:29 AM

All replies

  • OK I just spent time exploring the issue in detail, it's pretty easy to get very confused and here is why (I should add this machine does not have any service packs installed for VS 2005 just in case any of these are addressed/fixed)

     

    Image/Icon Resources Issues

     

    1. If I add a an image file or icon, to the project resource file (using the resource editor window) then add an ImageList to my form, I cannot populate the Images member for the ImageList using the resources I just added. It seems one may only add files from the file system. When I do this the image file is not imported as a resource, and does not appear as a resource.
    2. If I add a ToolStrip and create a new ToolStripButton within it, I can edit the Image property at design time. However when I do so I am only able to select image resource from the project resource file (other resource types are not visible). But if I then select “Import” and specify all file types in the add file dialog, I can add icon files. These appear in the Image section of  the resource editor.
    3. If I move to the resource editor for the project resource file, and set the mode to be “Images” I can see the image that was imported earlier. If I know try to add more images (using icon files) by selecting Add Resource -> Add Existing File and setting the file choice to .ico, the .ico file is added BUT it is added AS an icon, and appears within the resource editor ONLY when I set it to show icons, it does NOT appear as an image.
    4. Thus adding icons to the Image section of the resource editor results in icons being added and not images, BUT importing icons when prompted (for example when specifying the image on a toolbar button) does result in image resources being added.

     

     

    Because of the above behaviour, it is easy to become confused as to what has been added as an image, an icon or a resource.

     

    Importing when prompted (e.g. adding a toolbar button) does allow an icon to be converted to an image and appear as an image in resource editor.

     

    Adding an image to an ImageList provides no option for referring to already existing resources.

     

    Finally adding images directlty in the resource editor but specifying file type .ico does NOT cause icon to be converted to image, but simple adds it as an icon, so it appears only in icon mode in resource editor.

     

    This non-uniform behaviour has been the source of immense confusion.

     

     

     

    Tuesday, April 17, 2007 3:13 PM
  • OK I dont know if anyone else is bothered by this issue, but I just submitted a detailed bug report to Microsoft.

     

    If you have had issues and time wasting because of icon/image files and tree view, list view, tool bar button issues as well, then voting for the bug may lead MS to improve this area of the IDE:

     

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=271455

     

    Regards

    Hugh

     

    Tuesday, April 17, 2007 4:18 PM