nikez2k4
asked on
Minimise to System Tray not Taskbar as well.
Warning, c# N00b :-)
I'd like to minimise my app to the system tray, rather than the taskbar.
I've created a NotifyIcon and used the following code to hide the app from the taskbar:
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
Hide();
}
The app when minimised goes to the system tray just fine but I still have the app on the taskbar too.
Everywhere I've hunted seems to show the same code to what I've already quoted - Am I missing something obvious?
Thanks,
- M.
I'd like to minimise my app to the system tray, rather than the taskbar.
I've created a NotifyIcon and used the following code to hide the app from the taskbar:
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized
Hide();
}
The app when minimised goes to the system tray just fine but I still have the app on the taskbar too.
Everywhere I've hunted seems to show the same code to what I've already quoted - Am I missing something obvious?
Thanks,
- M.
You can set this.ShowInTaskbar = false
ASKER
Thanks for the reply... set it in .. here, or elsewhere?
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
Hide();
}
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized
Hide();
}
Hello, you could set ShowInTaskbar false when WindowState == Minimized and true when its not minimized.
But it shouldn't be necessary setting it at all... When I tried your Resize-method my program dissapeared form the taskbar just fine.
So there must be something else going on.
But it shouldn't be necessary setting it at all... When I tried your Resize-method my program dissapeared form the taskbar just fine.
So there must be something else going on.
ASKER
Went with this, which seems to work (not sure why the other one didnt)
-
private void Form1_Resize(object sender, System.EventArgs e)
{
//Check to see if the window has been Minimized:
if (this.WindowState == FormWindowState.Minimized)
{
//Remove the Program from the Task Bar:
this.ShowInTaskbar = false;
//Show the Icon in the system tray:
notifyIcon1.Visible = true;
}
-
-
private void Form1_Resize(object sender, System.EventArgs e)
{
//Check to see if the window has been Minimized:
if (this.WindowState == FormWindowState.Minimized)
{
//Remove the Program from the Task Bar:
this.ShowInTaskbar = false;
//Show the Icon in the system tray:
notifyIcon1.Visible = true;
}
-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.