1个回答
展开全部
//窗体大小改变事件
private void TestForm_SizeChanged(object sender, EventArgs e)
{
/型迟键/窗体状态为最小化时
if (this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;//不显示在任务栏
this.notifyIcon1.Visible = true;//显示托盘图标
//设置气泡文本和标题,也可以在设计视图界面填写
notifyIcon1.BalloonTipText = "气泡文本";
notifyIcon1.BalloonTipTitle = "气泡标题";
notifyIcon1.ShowBalloonTip(2000);//卜巧显示气泡提示,参数为显旦唤示时间
}
}
//托盘图标双击事件
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
//还原
this.WindowState = FormWindowState.Normal;
this.Activate();
this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
}
}
private void TestForm_SizeChanged(object sender, EventArgs e)
{
/型迟键/窗体状态为最小化时
if (this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;//不显示在任务栏
this.notifyIcon1.Visible = true;//显示托盘图标
//设置气泡文本和标题,也可以在设计视图界面填写
notifyIcon1.BalloonTipText = "气泡文本";
notifyIcon1.BalloonTipTitle = "气泡标题";
notifyIcon1.ShowBalloonTip(2000);//卜巧显示气泡提示,参数为显旦唤示时间
}
}
//托盘图标双击事件
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
//还原
this.WindowState = FormWindowState.Normal;
this.Activate();
this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询