I have an application that I do not want to show in the taskbar. When the application is minimized it minimizes to the SysTray.
The problem is, when I set ShowInTaskbar = false
the minimized application shows above the task bar, just aboe the Windows 7 start button. If I set ShowInTaskbar = true
the application minimizes correctly, but obviously the application shows in the taskbar.
Any idea why this is happening and how I can fix it?
EDIT: For the sake of clarity, here is the code I'm using:
private void Form1_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized) {
this.Hide();
this.Visible = false;
notifyIcon1.Visible = true;
}
else
{
notifyIcon1.Visible = false;
}
}
private void btnDisable_Click(object sender, EventArgs e)
{
// Minimize to the tray
notifyIcon1.Visible = true;
WindowState = FormWindowState.Minimized; // Minimize the form
}