在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1.设置窗体属性ShowInTaskbar=false 2.加notifyicon控件notifyicon1,为控件notifyicon1的属性icon添加一个icon图标。
代码
//窗体最小化
private void FrmMain_SizeChanged(object sender, EventArgs e) { if(this.WindowState==FormWindowState.Minimized) { this.Visible = false; this.WindowState = FormWindowState.Minimized; this.notifyIcon1.Visible = true; } } private void notifyIcon1_DoubleClick(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Normal) { this.notifyIcon1.Visible = true; } else { this.Visible = true; this.WindowState = FormWindowState.Normal; this.notifyIcon1.Visible = false; } } private void FrmMain_FormClosed(object sender, FormClosedEventArgs e) { this.notifyIcon1.Visible = false; }
|
请发表评论