what is the code for restoring application from sys tray

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i've this code that minimize application to sys tray i managed to hide the
application to the sys tray but i don't know how to bring it up back by
double cliking the sys tray icon

this is the code for the hide

private void SysTrayIcon_MouseDoubleClick(object sender,
MouseEventArgs e)
{

if (this.WindowState == FormWindowState.Normal)
{

this.Hide();

}
 
Avi said:
application to the sys tray but i don't know how to bring it up back by
double cliking the sys tray icon

How about this (watch for typos):

private void SysTrayIcon_MouseDoubleClick(...)
{
if (this.WindowState == FormWindowState.Normal)
{
this.Hide();
}
else
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = true;
}
}
}
 
i try this and it's not coming back from the Sys Tray, the problem is that
when i minimize the form1 it doesn't go to the tool bar it minimized to the
Sys Tray.
 
Chris said:
How about this (watch for typos):

private void SysTrayIcon_MouseDoubleClick(...)
{
if (this.WindowState == FormWindowState.Normal)
{
this.Hide();
}
else
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = true;
}
}
}

That might not work since the form is hidden, not minimized.

Try:


if (this.Visible == true)
{
this.Hide();
}
else
{
this.Show();
}

I think that should work....

Dan Manges
 
Try this

if (this.WindowState != FormWindowState.Normal)

this.WindowState = FormWindowState.Normal;

this.Opacity = 100;
this.TopMost = true;
this.Show();
 
yes,it's working great.Thanks

Dan Manges said:
That might not work since the form is hidden, not minimized.

Try:


if (this.Visible == true)
{
this.Hide();
}
else
{
this.Show();
}

I think that should work....

Dan Manges
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top