VB6 Form Icons display as negatives

Posted on 2008-11-13
Last Modified: 2012-05-05
In my VB6 app I have one form that can be used for several things, and depending on what it's used for it changes its icon.
In the development environment this works fine, but when in a compiled and installed app the icons come out as negative versions of what they should, like a film negative with all the colours reversed (see attached picture)
I have tried:
Loading the icon from another form
Me.Icon = frmIcons.imgDefIcon(0).Picture
Loading the icon directly from the source file.
Me.Icon = LoadPicture("C:\Projects\Icons\16\user_16x16.ico")
Both cause the same problem. This only happens on the forms that change their icon, not on ones that keep the one specified at design time.
I load icons from other forms all the time, and this works fine in the IDE or on a compiled program, but it doesn't seem to work when it's settign the form icon, as opposed to an icon displayed somewhere else on the form.
Any thoughts?
Question by:Charlie_Barnard
    LVL 10

    Accepted Solution

    Try adding the icons to an image list, i would imagine it's something to do with the fact that you're loading a 'picture' using both methods above and VB is doing a crappy job of converting it to an icon. If you add them to an imagelist and retrieve them from there it should save them as an icon and give your caller an icon instead of a bitmap which should fix your problem =) It's also a cleaner practice ;)
    LVL 10

    Expert Comment

    Sorry just incase, the imagelist is a control contained in the 'Microsoft Common Controls 6' component. You can add and remove images by right clicking it and going to properties ;)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now