public ContextMenu traymenu; public Form() { trayMenu = new ContextMenu(); trayMenu.MenuItems.Add("Logout", OnExit); trayIcon = new NotifyIcon(); trayIcon.Text = "KHorizon Chat"; trayIcon.Icon = new System.Drawing.Icon(KHorizon_Chat.Properties.Resources.chat, 40, 40); trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; InitializeComponent(); } private void Form_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; this.Visible = false; } private void OnExit(object sender, EventArgs e) { System.Environment.Exit(0); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)