public
partial
class
MainForm : Form
{
FormWindowState fws = FormWindowState.Normal;
public MainForm()
{
InitializeComponent();
this .SizeChanged += new EventHandler(MainForm_SizeChanged);
this .notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
this .notifyIcon1.Icon = new Icon( " Virgo.ico " );
this .notifyIcon1.Visible = false ;
}
void MainForm_SizeChanged( object sender, EventArgs e)
{
if ( this .WindowState == FormWindowState.Minimized)
{
this .ShowInTaskbar = false ;
this .notifyIcon1.Visible = true ;
}
else
{
fws = this .WindowState;
}
}
void notifyIcon1_DoubleClick( object sender, EventArgs e)
{
if ( this .WindowState == FormWindowState.Minimized)
{
this .ShowInTaskbar = true ;
this .notifyIcon1.Visible = false ;
this .WindowState = fws;
}
}
}
{
FormWindowState fws = FormWindowState.Normal;
public MainForm()
{
InitializeComponent();
this .SizeChanged += new EventHandler(MainForm_SizeChanged);
this .notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
this .notifyIcon1.Icon = new Icon( " Virgo.ico " );
this .notifyIcon1.Visible = false ;
}
void MainForm_SizeChanged( object sender, EventArgs e)
{
if ( this .WindowState == FormWindowState.Minimized)
{
this .ShowInTaskbar = false ;
this .notifyIcon1.Visible = true ;
}
else
{
fws = this .WindowState;
}
}
void notifyIcon1_DoubleClick( object sender, EventArgs e)
{
if ( this .WindowState == FormWindowState.Minimized)
{
this .ShowInTaskbar = true ;
this .notifyIcon1.Visible = false ;
this .WindowState = fws;
}
}
}