You need to do this (you can change the defined names for these, but for
tutorial sake, use what I have stated below until you get the hang of it):
Add a context menu to your form called "IconMenu"
Create two options in this menu. Once called "MenuOpen" the other
called "MenuExit"
in your form constructor add this:
this.SizeChanged += new EventHandler(Form1_SizeChanged);
this.MenuOpen.Click += new System.EventHandler(this.MenuOpen_Click);
this.MenuExit.Click += new System.EventHandler(this.MenuExit_Click);
now add this code to the form class:
public NotifyIcon TrayIcon;
private bool Shown;
and finally add this to your Form1_load event:
TrayIcon = new NotifyIcon();
Shown = true;
TrayIcon.Visible = false;
TrayIcon.Icon = this.Icon;
TrayIcon.Text = "Aplication Running...";
TrayIcon.ContextMenu = this.IconMenu;
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.