c# 创建 windows 托盘图标及上下文菜单
作者:互联网
using System.Windows.Forms; using System.Drawing; private NotifyIcon notifyIcon; private void createNotify() { notifyIcon = new NotifyIcon(); notifyIcon.Text = System.Windows.Forms.Application.ProductName; notifyIcon.Visible = true; ShowInTaskbar = false; notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); var open = new System.Windows.Forms.MenuItem("显示"); //open.Click += Open_Click; var hide = new System.Windows.Forms.MenuItem("隐藏"); //hide.Click += Hide_Click; notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new System.Windows.Forms.MenuItem[] { open, hide }); //notifyIcon.MouseDoubleClick += _notifyIcon_MouseDoubleClick; }
标签:notifyIcon,c#,System,Forms,windows,Windows,new,Click,图标 来源: https://www.cnblogs.com/nanfei/p/15365688.html