|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get the Application Icon??Hello all,
I am trying to write a simple app with no forms, but which uses a system tray icon and a context menu. I want to set the icon for the NotifyIcon to the icon which is set for the application in the My Project settings dialog. How can i get this icon? Thanks in advance. - Arthur Dent. > I am trying to write a simple app with no forms, but which uses a system Assuming the name of the icon is xxx, try this> tray icon and a context menu. I want to set the icon for the NotifyIcon to > the icon which is set for the application in the My Project settings dialog. Dim s as string = Application.ProductName & ".xxx.ico" Icon = New Icon(Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(s)) Actually, i found i think an easier way, though maybe not the "proper" way?
I wound up doing myNotifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.GetExecutablePath()) Show quoteHide quote "AMercer" <AMer***@discussions.microsoft.com> wrote in message news:F991F365-6385-4CCC-AC01-11DAF78DBD60@microsoft.com... >> I am trying to write a simple app with no forms, but which uses a system >> tray icon and a context menu. I want to set the icon for the NotifyIcon >> to >> the icon which is set for the application in the My Project settings >> dialog. > > Assuming the name of the icon is xxx, try this > > Dim s as string = Application.ProductName & ".xxx.ico" > Icon = New > Icon(Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(s)) > > Actually, i found i think an easier way, though maybe not the "proper" way? In my case, I have a few icons as embedded resources in my exe file, and I can get at any one by name with the fragment in my previous post. In your case, you want the icon associated with the app, so I think you are doing exactly the right thing. Also, your code will work in any app without the code needing to know the icon name, and that is a plus in my opinion.
Dynamic DataGridView missing horizontal scrollbar
Suggestions to reduce memory use when splitting a string How do you use an unbound DataAdapter? Easy One: Bind a Text Box to a an Integer Variable Dummy question Can't get rid of references Accessing Properties within a Panel Inheritance Reflection Question and MDI question Form Focus |
|||||||||||||||||||||||