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;
        }

 

上一篇:4.3jquery ajax


下一篇:How to Install Volvo Premium Tech Tool PTT Software