homebrew311 Posted February 2, 2004 Posted February 2, 2004 ok heres the deal: i wanna make an app that is just a system tray icon that i can right click and do stuff. i am trying not to involve a form at all. i just want to be able to right clikc the icon and bring up a menu and then select something from the menu for the program to do. wut im trying to say may be confusing but just ask me and ill go into more detail. Quote
*Experts* mutant Posted February 2, 2004 *Experts* Posted February 2, 2004 To get the icon into the system tray use the System.Windows.Form.NotifyIcon class. Then you have to add a context menu object to the icon, using the ContextMenu property orf the icon. Dim mnu As New ContextMenu mnu.MenuItems.Add("Hello") 'there is also an overload that accepts an event handler so you can use that trayicon.ContextMenu = mnu You also will have to set an icon image for the icon. trayicon.Icon = new Icon("path") Also, you have to make it visible. trayicon.Visible = True Now, to make that happen, you can start your program from sub Main. Forst declare the tray icon and the menu, then use the Application.Run() method to start the message loop for your app. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.