如何创建没有表单的notifyIcon? [重复]

|                                                                                                                   这个问题已经在这里有了答案:                                                      
已邀请:
我相信您需要添加一些其他事件才能起作用,希望这会有所帮助
public Form2()
    {
        InitializeComponent();
        notifyIcon1.Icon = SystemIcons.Asterisk;
        notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);// to bring it back
        this.Resize += new EventHandler(Form2_Resize);// to move it to tray
    }

    void notifyIcon1_DoubleClick(object sender, EventArgs e)
    {
        Show();
        this.BringToFront();
        this.WindowState = FormWindowState.Normal;
    }

    void Form2_Resize(object sender, EventArgs e)
    {
        if (this.WindowState ==FormWindowState.Minimized)
            Hide();
    }
    
表单最小化时显示通知图标。尝试这个
 this.WindowState = FormWindowState.Minimized;
    

要回复问题请先登录注册