with the NotifyIcon control in Visual Studio.
NotifyIcon is in the System.Windows.Forms namespace.
Drag and drop a NotifyIcon control to your form.
To send your application form into the system tray,
we simple handle the form re-size event.
private void frmMain_Resize(object sender, EventArgs e)We can also set BallonTipIcon, BallonTipText, BallonTipTitle and Icon ,
{
if (FormWindowState.Minimized == this.WindowState)
{
mynotifyicon.Visible = true;
mynotifyicon.ShowBalloonTip(500);
this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
{
mynotifyicon.Visible = false;
}
}
for our NotifyIcon control.
mynotifyicon.BallonTipText = "My application still working...";
mynotifyicon.BallonTipTitle = "My Sample Application";
mynotifyicon.BallonTipIcon = ToolTipIcon.Info;
12 comments:
Please see this as well Click Here for another example
Thank you ^^
Thank you.
Thank you
thankyou
Thank You!!!
Thank you, really it's helpful
Thank you very much,
but I think there is a little mistake in the second code block:
You wrote balloon just with one "o" ;).
Keep in mind you may need
//
// frmMain
//
this.Resize += new System.EventHandler(this.frmMain_Resize);
in your Designer.cs
Dominik Ras
THANK YOU for advise
i need that to minimize
when the applicarion are running, in windows xp i can´t shut down the pc, i need close the aplication and after shut down the pc. Anity idea??????
For a form that minimizes to the tray to be brought back up by a click of the NotifyIcon, I use
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon.Visible = true;
this.Hide();
}
}
private void notifyIconGT_Click(object sender, EventArgs e)
{
notifyIconGT.Visible = false;
this.Show();
this.WindowState = FormWindowState.Normal;
}
Make sure the NotifyIcon is marked as not visible from within the form designer.
Post a Comment