|
-
August 11th, 2009, 09:12 AM
#1
"bind" icon-file to form/notifyicon
Hello! I have a form and a notify-icon and both of them have an associated ico-file. When changing the ico-file, you have to go to the properties and choose the icon again in order to make the changes effective.
Is there any way to tell Visual-Studio to "bind" the icon to the icon-file, so when rebuilding the project the icon refreshes from the file if it has been changed?
-
August 11th, 2009, 09:16 AM
#2
Re: "bind" icon-file to form/notifyicon
How about adding the icon as a resource, as described here :
http://support.microsoft.com/default.aspx/kb/324567
¿
What version of .NET do you have ¿
-
August 11th, 2009, 09:23 AM
#3
Re: "bind" icon-file to form/notifyicon
Thanks for your fast reply. The icon was already added to the solution-explorer. So in the Properties Window, I set the build action to "embeded resource" - but still the icon is not changed (even when rebuilding the whole project). Any ideas about that?
-
August 11th, 2009, 10:03 AM
#4
Re: "bind" icon-file to form/notifyicon
You see, the whole problem is :
When you add a resource to your project, a copy is made, and stored in a different place than what it was originally. When you change the file ( where you have last saved it ), the project still has a copy of the old version saved.
What I want to suggest is to delete the resource from your project, and remove it from the form, and the NotifyIcon, so all references to it. Then, at form load, just set the icon for bot the form as well as the notifyicon through code :
Code:
private void Form1_Load(object sender, EventArgs e)
{
this.Icon = Icon.ExtractAssociatedIcon("Adriaan.ico");
notifyIcon1.Icon = Icon.ExtractAssociatedIcon("Adriaan.ico");
}
I hope my info was helpful!
-
August 11th, 2009, 10:11 AM
#5
Re: "bind" icon-file to form/notifyicon
Thanks again for your reply. But when I use ExtractAssociatedIcon and distribute the application I would have to add the icon-files, right? That would be a disadvantage.
You say that a copy is made - where is this copy stored? Because I couldn't find it. But if I could locate it I could just edit the copy to take effect in the next build.
-
August 11th, 2009, 11:10 AM
#6
Re: "bind" icon-file to form/notifyicon
 Originally Posted by martho
Thanks again for your reply. But when I use ExtractAssociatedIcon and distribute the application I would have to add the icon-files, right? That would be a disadvantage.
Well, it is part of your project, a resource then would also be a disadvantage. Icon files are small in size. But still, I agree not having it deployed with, because it may get deleted etc. Will the icon file change often ¿ Or is it just now that its changing so much ¿
 Originally Posted by martho
You say that a copy is made - where is this copy stored? Because I couldn't find it.
Mine is stored inside my solution folder, where you see the .csproj and cs files.
 Originally Posted by martho
But if I could locate it I could just edit the copy to take effect in the next build.
That may also not work
-
August 11th, 2009, 11:24 AM
#7
Re: "bind" icon-file to form/notifyicon
 Originally Posted by HanneSThEGreaT
Well, it is part of your project, a resource then would also be a disadvantage. Icon files are small in size. But still, I agree not having it deployed with, because it may get deleted etc. Will the icon file change often ¿ Or is it just now that its changing so much ¿
It's just while developing you see that the icon doesn't fit, so you change it, and I want to see the result quickly - and it drives you crazy to set the icon every time.
 Originally Posted by HanneSThEGreaT
Mine is stored inside my solution folder, where you see the .csproj and cs files.
Mine, too...
-
August 11th, 2009, 11:36 AM
#8
Re: "bind" icon-file to form/notifyicon
 Originally Posted by martho
It's just while developing you see that the icon doesn't fit, so you change it, and I want to see the result quickly - and it drives you crazy to set the icon every time.
Yep, True words! 
It's usually the small things that give the biggest headaches! LOL!
-
August 12th, 2009, 08:04 AM
#9
Re: "bind" icon-file to form/notifyicon
Thanks a lot - it helps to see someone suffering just the same ;-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|