C#怎样才能实现窗体最小化到托盘呢?

发布时间:2009年06月16日      浏览次数:653 次
VS2005 中工具栏里有一个 NotifyIcon控件,双击此控件,加上下面两段代码,即可轻松实现窗体最小化到托盘了。
private void Form1_Resize(object sender, System.EventArgs e) {
if (this.WindowState == FormWindowState.Minimized) {
this.Visible = false;
this.notifyIcon1.Visible = true;
}
}
private void notifyIcon1_Click(object sender, System.EventArgs e) {
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = false;
}
然后自己再加一张ico的图片
免责声明:本站相关技术文章信息部分来自网络,目的主要是传播更多信息,如果您认为本站的某些信息侵犯了您的版权,请与我们联系,我们会即时妥善的处理,谢谢合作!