惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
博客园 - 聂微东
L
LangChain Blog
D
Docker
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
C
Cisco Blogs
L
LINUX DO - 热门话题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
N
News and Events Feed by Topic
Latest news
Latest news
PCI Perspectives
PCI Perspectives
TaoSecurity Blog
TaoSecurity Blog
博客园 - 司徒正美
量子位
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
SecWiki News
SecWiki News
美团技术团队
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
AWS News Blog
AWS News Blog
C
Check Point Blog
S
Security Affairs
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
K
Kaspersky official blog
IT之家
IT之家
A
About on SuperTechFans
Help Net Security
Help Net Security
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Recorded Future
Recorded Future
月光博客
月光博客
博客园_首页
小众软件
小众软件
H
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿

博客园 - hzman

ASP采集入库生成本地文件的几个FUCTION 用XMLhttp编写web采集程序 无需安装软件架设NOD32升级服务器指南! 架设NOD32升级服务器 - hzman - 博客园 C#游戏外挂代码 VC7转换到VC8的常见问题 ini文件操作类 OllyDBG 入门系列(二)-字串参考 OllyDBG 入门系列(一)-认识OllyDBG - hzman - 博客园 live.cn邮箱注册帐号方法 - hzman - 博客园 免手机验证码网站备案 ASP同一虚拟空间放多个站点(各站点对应独立域名)的方法 QQ空间代码说明 页面间传值方法 C#代码,功能为拦截http请求,并篡改其中任何内容 深入浅出之正则表达式 两个分析HTML网页的方法 提取HTML代码中文字的C#函数 c#字符串截取函数
C#编写NotifyIcon
hzman · 2007-06-22 · via 博客园 - hzman

1.设置窗体属性showinTask=false

2.加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。

3.添加窗体最小化事件(首先需要添加事件引用):

// this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

//上面一行是主窗体InitializeComponent()方法中需要添加的引用

private void Form1_SizeChanged(object sender, EventArgs e)
 {
  if (this.WindowState==FormWindowState.Minimized)
  {
   this.Hide();
   this.notifyIcon1.Visible=true;
  }

 }
4.添加点击图标事件(首先需要添加事件引用):

 private void notifyIcon1_Click(object sender, EventArgs e)
 {
  this.Visible = true;

  this.WindowState = FormWindowState.Normal;

  this.notifyIcon1.Visible = false;
 }

5.可以给notifyIcon添加右键菜单:

主窗体中拖入一个ContextMenu控件contextMenu1,点中控件,在上下文菜单中添加菜单,notifyIcon1的ContextMenu行为中选中contextMenu1作为上下文菜单。

(可以在子菜单中添加行为)