vc#做的windows程序,如何让程序在最小化时进入系统托盘?(就是在右下角的栏) vc#做的windows程序,如何让程序在最小化时进入系统托盘?(就是在右下角的栏) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 NotifyIcon查一查MSDN吧,有例程。 用NotifyIcon控件,把窗体的ShowInTaskBar设置为false就可以了 在窗体的Resize事件里if (this.WindowState == FormWindowState.Minimized) { this.Visible=false; } else { this.Visible = true; }在NotifyIcon的DoubleClick事件里if(this.Visible == false) { this.Visible = true; this.WindowState = FormWindowState.Normal; } else { this.WindowState = FormWindowState.Minimized; this.Visible = false; } http://www.yesky.com/425/213425.shtml一篇用Visual C#做托盘程序的教程 主要代码,private void ShowHideWindow(bool isShow){ if(isShow)//显示 { if(this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; } if(this.ShowInTaskbar==false) { this.ShowInTaskbar = true; this.Show(); } this.Activate(); } else//隐藏 { if(this.WindowState == FormWindowState.Maximized) { this.WindowState = FormWindowState.Normal; } if(this.ShowInTaskbar == true) { this.Hide(); this.ShowInTaskbar = false; } }} private void Form1_Resize(object sender, System.EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Visible=false; this.notifyIcon1.Visible = true; } else { this.Visible = true; this.notifyIcon1.Visible = false; } } private void notifyIcon1_DoubleClick(object sender, System.EventArgs e) { if(this.Visible == false) { this.Visible = true; this.WindowState = FormWindowState.Normal; this.notifyIcon1.Visible = false; } else { this.WindowState = FormWindowState.Minimized; this.Visible = false; this.notifyIcon1.Visible = true; } } DataList显示字符串问题 Repeater出现警告 100分在线等关于winform窗体上鼠标坐标的问题,急!!! 尊敬的各位前辈,我只熟悉VB+SQL,刚刚想转C#,请大家推荐入门书籍给我 用GDI+画了一个流程图,可是颜色失真了。 如何做客户端的数据检索? 变量名、函数名用中文可以吗? 各位大哥!小弟向大家问好了!请问directx9是否没有directshow了??? 继承自Fluent:RibbonWindow的wpf窗体怎么去掉最大化按钮? 如何彻底关闭子窗体? 轻松玩转"格式"转换... 我想在服务器端得到无刷新的提示信息??谢谢
就可以了
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible=false;
}
else
{
this.Visible = true;
}
在NotifyIcon的DoubleClick事件里
if(this.Visible == false)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
else
{
this.WindowState = FormWindowState.Minimized;
this.Visible = false;
}
private void ShowHideWindow(bool isShow)
{
if(isShow)//显示
{
if(this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
}
if(this.ShowInTaskbar==false)
{
this.ShowInTaskbar = true;
this.Show();
}
this.Activate();
}
else//隐藏
{
if(this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
if(this.ShowInTaskbar == true)
{
this.Hide();
this.ShowInTaskbar = false;
}
}
}
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible=false;
this.notifyIcon1.Visible = true;
}
else
{
this.Visible = true;
this.notifyIcon1.Visible = false;
} } private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
if(this.Visible == false)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.notifyIcon1.Visible = false;
}
else
{
this.WindowState = FormWindowState.Minimized;
this.Visible = false;
this.notifyIcon1.Visible = true;
} }