winform窗体最小化到系统托盘

1、添加notifyIcon控件,名为notifyIcon1,在其属性中将Visible=false。
2、加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。
3、添加Resize事件,请选中窗体并是事件中选择Resize,系统将自动生成包括委托在内的代码。添加:
private void Form1_Resize(object sender, EventArgs e)
{
    if (this.WindowState == FormWindowState.Minimized)
    {
        this.Hide();
        this.notifyIcon1.Visible = true;
    }
}

4、双击notifyIcon1,进入代码编写页,输入:
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
    this.Visible = true;
    this.WindowState = FormWindowState.Normal;
    this.notifyIcon1.Visible = false;
}


上一篇:一个“落伍者”的十年建站路

下一篇:DataGridView自动调整行高和行宽

留下脚印压缩包密码:sosuo8
名字:
全部评论:
评论blade & soul gold2016/1/16 12:13:00
I respect your work. 
blade & soul gold https://wildstargoldmarket.wordpress.com/2016/01/04/how-can-we-get-a-chain-version-of-falling-blocks-in-blade-and-sou/
答复
评论Singam2014/3/23 9:01:00
The hotnesy of your posting shines through
答复
评论aa2010/12/30 11:02:00
答复^-^
申明:本站部分文章来自网络,由于各种原因对文章的来源无从考究,如果您是“ winform窗体最小化到系统托盘 ”的原作者,若侵犯您的版权,请与我联系!在此请您原谅我的幼稚和无知!联系方法:email:ahuinan@21cn.com  QQ:106494262

感谢以下网友对网站提出的建议:
1、感谢“蓝树叶kiss”网友发现一个评论漏洞。(2009-2-28)
2、感谢“陈臣”对程序优化和seo方面的建议。(2009-3-18)
文章档案
  • 作者:阿会楠
  • 来源:搜索吧
  • 日期:2008/2/29 9:08:00
  • 点击:6741
网友投票(您觉得这篇文章怎样?)
loadding...请稍侯......