//private System.Windows.Forms.NotifyIcon notifyIcon1;
private NotifyIcon notifyIcon1;
public Form5()
{
InitializeComponent();
//指定使用的容器
notifyIcon1 = new NotifyIcon();
//this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
//建立NotifyIcon
this.notifyIcon1.Icon = new Icon(@"C:\Documents and Settings\0130\My Documents\Downloads\easter-egg-6.ico");
this.notifyIcon1.Text = "NotifyIcon Example";
this.notifyIcon1.MouseDoubleClick += new MouseEventHandler(notifyIcon1_MouseDoubleClick);
}
private void Form5_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible = true;
}
}
protected void notifyIcon1_MouseDoubleClick(object sender, EventArgs e)
{
this.Show();
notifyIcon1.Visible = false;
this.WindowState = FormWindowState.Normal;
}
沒有留言:
張貼留言