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

How to retreive the application Icon

P: n/a
I currently have an app whose Icon I am setting. I want to set the icons in
my forms at run time to that of the application icon. How do I retrieve the
application Icon so that I can use it for my forms? once retrieved can I
just set the form Icon? or do I need to do something special?

Thanks
Wayne
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Wayne,

I would create a class with a static member which would return the icon
when called. Then, all of your forms would access this static method to set
the icon that it should have. Where you get this icon is up to you (you can
get it from a resource file, etc, etc).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Wayne" <ws*****@NoLandSpamstar.com> wrote in message
news:eQ****************@tk2msftngp13.phx.gbl...
I currently have an app whose Icon I am setting. I want to set the icons in my forms at run time to that of the application icon. How do I retrieve the application Icon so that I can use it for my forms? once retrieved can I
just set the form Icon? or do I need to do something special?

Thanks
Wayne

Nov 16 '05 #2

P: n/a
I don't really want to do it that way, I currently have some plugins that
may or may not display forms when they are shown. I'd like to be able to
have the plugin query information from the main assembly to get the Icon.
Not to mentioned I'd like to figure out how to do it.

Thanks
Wayne

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:#w**************@TK2MSFTNGP10.phx.gbl...
Wayne,

I would create a class with a static member which would return the icon when called. Then, all of your forms would access this static method to set the icon that it should have. Where you get this icon is up to you (you can get it from a resource file, etc, etc).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Wayne" <ws*****@NoLandSpamstar.com> wrote in message
news:eQ****************@tk2msftngp13.phx.gbl...
I currently have an app whose Icon I am setting. I want to set the icons

in
my forms at run time to that of the application icon. How do I retrieve

the
application Icon so that I can use it for my forms? once retrieved can I
just set the form Icon? or do I need to do something special?

Thanks
Wayne


Nov 16 '05 #3

P: n/a
Wayne

If you are referring to the App.ico resource that the wizard supplies, you
can compile the App icon as an embedded resource - then create a static
method as Nicholas suggested to return a reference to the Icon object. In
Solution Explorer, right click on the icon resource, select Properties, and
change the Build Action to Embedded Resource. Then to get the icon resource
into an Icon object, try something like this in the main method of your app:

static void Main()
{
myIcon = new Icon(typeof(Form1),"MY_ICON.ICO");
/* do something with myIcon here... */
Application.Run(new Form1());
}

You can easily add icons and include them as resources in the assembly using
the IDE Add|Existing Item, browsing to the file that contains the .ico
resource, and then changing the Build Action to Embedded Resource.

Note - the icon resource name is case sensitive in the Icon constructor...

regards
roy fine

"Wayne" <ws*****@NoLandSpamstar.com> wrote in message
news:eQ****************@tk2msftngp13.phx.gbl...
I currently have an app whose Icon I am setting. I want to set the icons in my forms at run time to that of the application icon. How do I retrieve the application Icon so that I can use it for my forms? once retrieved can I
just set the form Icon? or do I need to do something special?

Thanks
Wayne

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.