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

推荐订阅源

罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
博客园 - 三生石上(FineUI控件)
V
V2EX
有赞技术团队
有赞技术团队
V
Visual Studio Blog
小众软件
小众软件
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
量子位
T
Tailwind CSS Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
Cisco Talos Blog
Cisco Talos Blog
I
Intezer
Project Zero
Project Zero
A
Arctic Wolf
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
L
Lohrmann on Cybersecurity
S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tor Project blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Security @ Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
L
LINUX DO - 热门话题
G
GRAHAM CLULEY
Help Net Security
Help Net Security
N
News | PayPal Newsroom
W
WeLiveSecurity
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog

博客园 - 白虎

软件架构设计的六大原则 Linux 安装npm 下载ECharts Linux 安装WebStorm Linux配置开机自启动执行脚本 Linux挂载第二块硬盘 Linux 安装Nginx Linux个性终端Oh my zsh Linux 第一个脚本程序 Linux 8开启FTP功能服务 Jigloo 下载 安装 GUI Linux应用开发入门(转) NET(C#)连接各类数据库-集锦 管理型交换机IEEE 802.1Q VLAN设置应用实例 Windows Server 2012如何实现双网卡绑定 多网卡的7种bond模式原理 For Linux Eplan中电缆源和目标的确定规则 Eplan 2D安装版布局,部件、端子竖放 EPLAN Electric P8 2.0即将到来,着实令人期待-转caodaping 关于STM32 CAN回环可用,正常不可用情况分析
C# 编写最小化时隐藏为任务栏图标的Window appllication
白虎 · 2018-05-10 · via 博客园 - 白虎

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作为上下文菜单。