您的位置:首页 > 编程语言 > C#

C#实现窗体最小化到状态栏,双击运行时又能正常显示窗体

2013-11-27 16:31 726 查看
【转载】
首先在窗体中添加一个 notifyIcon1控件 ,
Then:


//添加事件《实现最小化之后任务栏显示图标》
private void Form1_StyleChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.notifyIcon1.Visible = true;
this.Visible = false;
}
}


//双击图标之后显示窗体
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = false;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: