Tray Application
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
this.Visible = false;
this.notifyIcon1.Visible = true;
notifyIcon1.ContextMenuStrip = contextMenuStrip1;
MaximizeBox = false;
MinimizeBox = false;
//getService();
// test();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
this.notifyIcon1.Visible = false;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
this.Show();
this.Visible = true;
this.ShowInTaskbar = true;
this.WindowState = FormWindowState.Normal;
}
private void 종료ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.ExitThread();
Environment.Exit(0);
Application.Exit();
this.notifyIcon1.Visible = false;
/*
* Application 강제 Process Kill
*/
//System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}