开发者

How do I create a windowless C# app that resides in the tray?

开发者 https://www.devze.com 2022-12-09 20:45 出处:网络
As question says, How do I create such开发者_开发问答 an app ? How do I make it windowless and make it reside in the system tray (bottom right) ?Here\'s an article about doing that. If you want it to

As question says, How do I create such开发者_开发问答 an app ? How do I make it windowless and make it reside in the system tray (bottom right) ?


Here's an article about doing that. If you want it to start minimized, just do a WindowState = FormWindowState.Minimized before showing the window, and remove the code in NotifyIcon.DoubleClick that maximizes it.


static class Program
{
    [STAThread]
    static void Main()
    {
        NotifyIcon icon = new NotifyIcon();
        icon.Icon = System.Drawing.SystemIcons.Application;
        icon.Click += delegate { MessageBox.Show("Bye!"); icon.Visible = false; Application.Exit(); };
        icon.Visible = true;
        Application.Run();
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号