Hi All,
I want to write a program to add some application into system tray and hide it. Who can guide me which class I should use? I used Process class to get Name and but I don't know how I can get applications in Taskbar to hide and add it into system tray.
Please help me!
Thanks
Loading
AlexPosted Oct 3, 2008, 3:13 PM
Once that's done, add an event handler to you're Form's resized event like so:
void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
Hide();
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(10);
}
else { notifyIcon1.Visible = false; }
}
This will hide the form from the taskbar, show the notification icon baloon for like 10 seconds and then just sit in the system tray.
You'll then also want to add a context menu to your notifyIcon to restore the app. You can do something like this:
ContextMenu menu = new ContextMenu();
menu.MenuItems.Add(new MenuItem("Restore",(o,e)=>{
this.Show();
this.WindowState = FormWindowState.Normal;
}));
this.notifyIcon1.ContextMenu = menu;
Hope that helps.