473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why do my icons randomly appear?

Hello,

I have an issue with images that appear and then seem to disappear depending
on the compile and exectution sequence I use. I haven't been able to narrow
down a repeateable sequnce. I suspect this is an initialization problem. I
wonder if anyone else knows how to fix this?

In my C# Form Load() method, I include the following (m_ToolBarImageList is
defined as a instance ImageList):

m_ToolBarImageList = new ImageList();
m_ToolBarImageList.ImageSize = new System.Drawing.Size(16, 16);
m_ToolBarImageList.TransparentColor = System.Drawing.Color.Transparent;

// Read images from a compiled resource
m_ToolBarImageList.Images.Add(Image.FromStream(Uti lities.GetIconAsStream("Resources.icons.Aladdin_16 x16.ico")));
m_ToolBarImageList.Images.Add(Image.FromStream(Uti lities.GetIconAsStream("Resources.icons.FAB_16x16. ico")));

// Assign the image list to the toolbar
this.toolBar1.ImageList = m_ToolBarImageList;

this.toolBar1.Buttons[0].ImageIndex=0;
this.toolBar1.Buttons[1].ImageIndex=1;
Jul 21 '05 #1
1 1235
Hello,

I assume you haven't marked your Main Method with
the right Appartment Model...

[STAThread]
public static void Main()

You have to mark it as single threaded.

HTH, Günther
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: drum118 | last post by:
Has anyone experience problems with firewall blocking some icons and not others. I am using Zone alarm and have the popup set for medium and it was blocking some of the icons for some strange...
1
by: Ronny | last post by:
Hi, When ever I use image lists in a tree view the image list is behaving inconsistent. When I add images they first look good and clean, after I have close and open the code in the IDE the...
1
by: Dave | last post by:
Hello, I have an issue with images that appear and then seem to disappear depending on the compile and exectution sequence I use. I haven't been able to narrow down a repeateable sequnce. I...
3
boxfish
by: boxfish | last post by:
I'm using Windows XP. Sometimes when I log on to my user, the icons on my desktop will appear as soon as the blue "Loading your personal settings" screen is done and I can start running programs...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.