views:

304

answers:

2

Hi, i am trying to get a c# winforms application to startup only in the system tray but when i use the following commands it shows in the system tray but also shows as a little title bar just above the taskbar on the left hand side above the start button (windows xp)

The funny thing is that it only happens when i run the application outside of visual studio.

Does anyone know what im doing wrong?

Constructor or Form_Load....

this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
this.Hide();
+1  A: 

Add an event handler for the form's Resize event that will hide the application when it's minimized. That way, it won't appear on the task bar.

private void Form1_Resize(object sender, System.EventArgs e)
{
   if (FormWindowState.Minimized == WindowState)
      Hide();
}
pipelinecache
A: 

Try this

this.Resize +=new EventHandler(Form1_Resize);
private void Form1_Resize(object sender, EventArgs e)
{
    if (this.WindowState == FormWindowState.Minimized)
    {
        this.Hide();
    }
}
Anuraj