softairhk

softairhk

  • NA
  • 115
  • 0

Questions on System Tray MenuItem

Oct 6 2003 10:28 PM
Hello! For the below listed coding, I want to ask three questions: 1) How add a submenu for "Show Control Form", i.e. when a mouse move over the "Show Control Form" option then will open a submenu. e.g. Submenu1, Submen2, Submenu 3 etc. 2) When to limit the "Show Control Form" won't open two times when it is opened? 3) How to add icon for the menuitem, e.g. add an icon on the left of "Show Control Form"? I got the complete coding, but this forum is not allow to upload. If anyone can tell me how to upload the coding? Thanks! private void InitializeNotifyIcon() { //setup the Icon NotifyIcon WSNotifyIcon = new NotifyIcon(); WSNotifyIcon.Icon = mDirIcon; WSNotifyIcon.Text = "System Tray Example"; WSNotifyIcon.Visible = true; //Create the MenuItem objects and add them to //the context menu of the NotifyIcon. MenuItem[] mnuItems = new MenuItem[3]; //create the menu items array mnuItems[0] = new MenuItem("Show Control Form", new EventHandler(this.ShowControlForm)); mnuItems[0].DefaultItem=true; mnuItems[1] = new MenuItem("-"); mnuItems[2] = new MenuItem("Exit", new EventHandler(this.ExitControlForm)); //add the menu items to the context menu of the NotifyIcon ContextMenu notifyIconMenu = new ContextMenu(mnuItems); WSNotifyIcon.ContextMenu=notifyIconMenu; } fm Softair

Answers (5)