By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Updating Application Icon

P: n/a
I have a Windows application that previously had the company logo
"MyCompany.ico" added to the upper left-most corner. The company has since
issued a new version of "MyCompany.ico" that looks completely different.

I overwrote the old ico file with the new ico file and re-ran the program. I
still see the old logo at run-time.

I right-clicked the project-> Add Existing Item-> added the new ico file. I
set the build action to Embedded Resource, and the Copy to Output to Copy
Always. I still see the old logo at run-time.

I right-clicked my project and selected properties. In the Application tab,
I selected my new Icon file. I see the new Icon appear to the right of the
elipse button. I STILL see the old icon at the upper left-most corner at run
time.

I added the following line to my start-up project constructor:

this.Icon = new Icon(@"..\..\MyCompany.ico");

This worked. I see the new logo at the upper left-most corner at run-time.

I'd really like to know why the other options didn't work. Please don't
answer unless you've actually tried this recently in Visual Studio 2005. I've
been at this a long time, and this is the first time I've had this much
trouble. I'm sure people are going to ask me why the first attempts didn't
work.

Thanks,
--
Randy
Jun 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
randy1200 wrote:
I have a Windows application that previously had the company logo
"MyCompany.ico" added to the upper left-most corner. The company has since
issued a new version of "MyCompany.ico" that looks completely different.

I overwrote the old ico file with the new ico file and re-ran the program.
I still see the old logo at run-time.

I right-clicked the project-> Add Existing Item-> added the new ico file.
I set the build action to Embedded Resource, and the Copy to Output to
Copy Always. I still see the old logo at run-time.

I right-clicked my project and selected properties. In the Application
tab, I selected my new Icon file. I see the new Icon appear to the right
of the elipse button. I STILL see the old icon at the upper left-most
corner at run time.

I added the following line to my start-up project constructor:

this.Icon = new Icon(@"..\..\MyCompany.ico");

This worked. I see the new logo at the upper left-most corner at run-time.

I'd really like to know why the other options didn't work. Please don't
answer unless you've actually tried this recently in Visual Studio 2005.
I've been at this a long time, and this is the first time I've had this
much trouble. I'm sure people are going to ask me why the first attempts
didn't work.

Thanks,


Hi Randy,

You may have updated the icon on the hard-drive, and even added it as an
embedded resource... but that's not how it becomes part of a form's icon.
A form has a property 'Icon', which you correctly assigned to, in order to
change the icon. The value of this property, when updated with the
designer is stored in a resource file, and not directly referenced from the
disk. You need to either update the form's resource file, with the new
icon, or simply browse for the new icon on your hard-drive, by means of the
Property Viewer (assuming you're using the Windows Forms Designer).

Does this answer your question?
-- Tom Spink
Jun 23 '06 #2

P: n/a
Thanks for the replay.

I commented out the this.Icon = new Icon(@"..\..\MyCompany.ico");

This brings me back to the previous icon displayed at run-time.
You need to either update the form's resource file, with the new
icon, or simply browse for the new icon on your hard-drive, by means of the
Property Viewer (assuming you're using the Windows Forms Designer).
<<<

How do I update the form's resource file? I tried right-clicking
Rsources.resx and selecting Refresh. No effect. Also, there's no explicit
reference to MyCompany.ico in either Resoucres.resx or Resources.Designer.cs.
MyCompany.ico is listed as a file in the solution explorer.

Is the property viewer what I get from right-clicking the project,
application tab, Resource Group, Icon? Again, I browse to the new icon, and
see it in the preview to the right of the browse button, but not at run-time.

Is it possible that the size of the file is causing problems with the two
methods above. The file size is 25 k. I believe the file is valid because it
displays using the "new Icon" line is the constructor.
Thanks,
--
Randy
"Tom Spink" wrote:
randy1200 wrote:
I have a Windows application that previously had the company logo
"MyCompany.ico" added to the upper left-most corner. The company has since
issued a new version of "MyCompany.ico" that looks completely different.

I overwrote the old ico file with the new ico file and re-ran the program.
I still see the old logo at run-time.

I right-clicked the project-> Add Existing Item-> added the new ico file.
I set the build action to Embedded Resource, and the Copy to Output to
Copy Always. I still see the old logo at run-time.

I right-clicked my project and selected properties. In the Application
tab, I selected my new Icon file. I see the new Icon appear to the right
of the elipse button. I STILL see the old icon at the upper left-most
corner at run time.

I added the following line to my start-up project constructor:

this.Icon = new Icon(@"..\..\MyCompany.ico");

This worked. I see the new logo at the upper left-most corner at run-time.

I'd really like to know why the other options didn't work. Please don't
answer unless you've actually tried this recently in Visual Studio 2005.
I've been at this a long time, and this is the first time I've had this
much trouble. I'm sure people are going to ask me why the first attempts
didn't work.

Thanks,


Hi Randy,

You may have updated the icon on the hard-drive, and even added it as an
embedded resource... but that's not how it becomes part of a form's icon.
A form has a property 'Icon', which you correctly assigned to, in order to
change the icon. The value of this property, when updated with the
designer is stored in a resource file, and not directly referenced from the
disk. You need to either update the form's resource file, with the new
icon, or simply browse for the new icon on your hard-drive, by means of the
Property Viewer (assuming you're using the Windows Forms Designer).

Does this answer your question?
-- Tom Spink

Jun 23 '06 #3

P: n/a
randy1200 wrote:
Thanks for the replay.

I commented out the this.Icon = new Icon(@"..\..\MyCompany.ico");

This brings me back to the previous icon displayed at run-time.

You need to either update the form's resource file, with the new
icon, or simply browse for the new icon on your hard-drive, by means of
the Property Viewer (assuming you're using the Windows Forms Designer).
<<<

How do I update the form's resource file? I tried right-clicking
Rsources.resx and selecting Refresh. No effect. Also, there's no explicit
reference to MyCompany.ico in either Resoucres.resx or
Resources.Designer.cs. MyCompany.ico is listed as a file in the solution
explorer.

Is the property viewer what I get from right-clicking the project,
application tab, Resource Group, Icon? Again, I browse to the new icon,
and see it in the preview to the right of the browse button, but not at
run-time.

Is it possible that the size of the file is causing problems with the two
methods above. The file size is 25 k. I believe the file is valid because
it displays using the "new Icon" line is the constructor.
Thanks,


Hi Randy,

I'm sure the file is valid. If you expand the form in the Solution Viewer,
it should show you a specific resources file for that form. I believe if
you open that, you'll be able to re-import the icon file.

When you have the form open in Design-View, you should just be able to
change the 'Icon' property of the form, using the 'Property Viewer'. The
property viewer should be underneath the Solution Explorer... hit F4 on
your keyboard, while the form is open, if it's not.

Hope this helps,
-- Tom Spink
Jun 23 '06 #4

P: n/a
Now I see it. That was extremely helpful. Many, many thanks...
--
Randy
"Tom Spink" wrote:
randy1200 wrote:
Thanks for the replay.

I commented out the this.Icon = new Icon(@"..\..\MyCompany.ico");

This brings me back to the previous icon displayed at run-time.
>

You need to either update the form's resource file, with the new
icon, or simply browse for the new icon on your hard-drive, by means of
the Property Viewer (assuming you're using the Windows Forms Designer).
<<<

How do I update the form's resource file? I tried right-clicking
Rsources.resx and selecting Refresh. No effect. Also, there's no explicit
reference to MyCompany.ico in either Resoucres.resx or
Resources.Designer.cs. MyCompany.ico is listed as a file in the solution
explorer.

Is the property viewer what I get from right-clicking the project,
application tab, Resource Group, Icon? Again, I browse to the new icon,
and see it in the preview to the right of the browse button, but not at
run-time.

Is it possible that the size of the file is causing problems with the two
methods above. The file size is 25 k. I believe the file is valid because
it displays using the "new Icon" line is the constructor.
Thanks,


Hi Randy,

I'm sure the file is valid. If you expand the form in the Solution Viewer,
it should show you a specific resources file for that form. I believe if
you open that, you'll be able to re-import the icon file.

When you have the form open in Design-View, you should just be able to
change the 'Icon' property of the form, using the 'Property Viewer'. The
property viewer should be underneath the Solution Explorer... hit F4 on
your keyboard, while the form is open, if it's not.

Hope this helps,
-- Tom Spink

Jun 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.