You probably don't even need the form at all. VS.NET automatically adds a
form to the project and adds Application.Run(new Form1()) to the static Main
method, but it's often totally unnecessary for a NotifyIcon application.
Example below. Note that it uses Application.Run() without a form parameter,
and the icon events can manipulate the Application state directly.
class MyApp
{
static NotifyIcon icon;
[STAThread]
static void Main()
{
icon = new NotifyIcon();
icon.Icon = new Icon("App.ico");
icon.Text = "Tooltip text here";
icon.Click += new EventHandler(Icon_Click);
icon.Visible = true;
Application.Run();
}
static void Icon_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Quit now?", "NotifyIcon",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
icon.Visible = false;
Application.Exit();
}
}
}