C#怎样做到窗体时最小化到状态栏,双击运行时又能正常显示窗体
2个回答
展开全部
首先在窗体中添加一个 notifyIcon1控件
//添加事件《实现最小化之后任务栏显示图标》
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;
}
//添加事件《实现最小化之后任务栏显示图标》
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;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询