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

推荐订阅源

The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
O
OpenAI News
NISL@THU
NISL@THU
AI
AI
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
W
WeLiveSecurity
P
Privacy International News Feed
Cisco Talos Blog
Cisco Talos Blog
S
Secure Thoughts
D
Docker
博客园 - 三生石上(FineUI控件)
T
Troy Hunt's Blog
T
Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
H
Hacker News: Front Page
B
Blog
S
SegmentFault 最新的问题
H
Heimdal Security Blog
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
小众软件
小众软件
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
Hacker News: Ask HN
Hacker News: Ask HN
Recent Announcements
Recent Announcements
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
PCI Perspectives
PCI Perspectives
I
Intezer
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed

博客园 - cjfwu

设计模式学习4-Bridge模式 设计模式学习3-Strategy模式 设计模式学习2-Adapter模式 设计模式学习1-Facade模式 设备控制(反馈处理) 通过System.IO.Packaging实现打包和解包 将目录添加环境变量 设备控制之矩阵状态显示 windows shell 编程3(函数解释) windows shell 编程2(浏览文件夹) windows shell 编程1(概念) 不同命名空间下名称和结构相同的类相互序列化与反序列化 通过SvcUtil.exe生成客户端代码和配置 分组 在“添加引用”对话框中显示需要的Assembly 只运行一个实例 SVN操作 获得树节点的高度 枚举的操作
托盘操作
cjfwu · 2008-04-03 · via 博客园 - cjfwu

  在窗体上放个 notifyIcon1 和contextMenuStrip1,将notifyIcon1的contextMenuStrip设为contextMenuStrip1
在contextMenuStrip1上加入open 和 exit 项

        private void ToolStripMenuItemOpen_Click(object sender, EventArgs e) {
            this.ShowInTaskbar = true;
            this.WindowState = FormWindowState.Normal;
            this.TopMost = true;        //这里如果用this.bringToFront()可以
            this.TopMost = false;
        }
       
        private void notifyIcon1_DoubleClick(object sender, EventArgs e) {
            this.ShowInTaskbar = true;
            this.WindowState = FormWindowState.Normal;
            this.TopMost = true;          //这里如果用this.bringToFront()则无效,搞不懂
            this.TopMost = false;
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
            this.WindowState = FormWindowState.Minimized;      //这句必须放在第二句前面,否则会在左下角有个小标题栏
            this.ShowInTaskbar = false;
            e.Cancel = true;
        }
       
        private void ToolStripMenuItemExit_Click(object sender, EventArgs e) {
            Application.ExitThread();
        }

//-------------------------------------------------------------------------------------------------------------------------
修改如下:
        private void openToolStripMenuItem_Click(object sender, EventArgs e) {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
            Application.ExitThread();
        }

        private void notifyIcon1_DoubleClick(object sender, EventArgs e) {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
            e.Cancel = true;
            this.Visible = false;
        }