notifyicon

Winforms - why does a “Show()” after a system tray double click end up in my app minimized?

血红的双手。 提交于 2021-01-28 03:31:49
问题 Winforms - why does a "Show()" after a system tray double click end up in my app minimized? How do I ensure Inthe notifyicon double click event that my hidden main form comes back visible as normal, not minimized (nor maximised for that matter too) 回答1: I would guess that you put your application in tray on minimize action. In that case, Show just restores visibility. Try adding form.WindowState = Normal before Show(). 回答2: Hiding your form with the NotifyIcon is often desirable so your app

Adding MenuItems to Contextmenu for a TrayIcon in a Console app

我的梦境 提交于 2021-01-28 01:11:14
问题 I made a little console app which locks the Mouse to the first screen. Now I want to create a TrayIcon with a ContextMenu to close the application. In debug-mode, I can see that the ContextMenu has two Items, just like it should, but it doesn't display the ContextMenu. An EventHandler shouldn't be needed from what I've read so far. My code: static void GenerateTrayIcon() { ContextMenu trayiconmenu = new ContextMenu(); trayiconmenu.MenuItems.Add(0, new MenuItem("Show", new EventHandler(Show

Windows notification created with NotifyIcon shows “microsoft.explorer.notification” and GUID

最后都变了- 提交于 2020-06-12 05:51:27
问题 We have written a WPF desktop application for Windows. The application launches on start-up and mostly runs in the background, but has a UI which is accessible via the system tray. Occasionally the app needs to notify the user of something, and so for this, we use the NotifyIcon library to generate notifications. Here is the relevant code: XAML: <mui:ModernWindow ... xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tb="http://www.hardcodet.net/taskbar" ... > <tb:TaskbarIcon x:Name

Windows notification created with NotifyIcon shows “microsoft.explorer.notification” and GUID

落花浮王杯 提交于 2020-06-12 05:50:30
问题 We have written a WPF desktop application for Windows. The application launches on start-up and mostly runs in the background, but has a UI which is accessible via the system tray. Occasionally the app needs to notify the user of something, and so for this, we use the NotifyIcon library to generate notifications. Here is the relevant code: XAML: <mui:ModernWindow ... xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tb="http://www.hardcodet.net/taskbar" ... > <tb:TaskbarIcon x:Name

Action<> multiple parameters syntax clarification

我只是一个虾纸丫 提交于 2020-05-26 12:47:22
问题 Sometimes I can't understand the simplest things, i'm sure it's in my face, i just fail to see it. Im trying to create a delegate for a method in this simple class: public static class BalloonTip { public static BalloonType BalType { get; set; } public static void ShowBalloon(string message, BalloonType bType) { // notify user } } Now, this Action<> is supposed to create the delegate without actually declaring one with the keyword "delegate", did I understand correctly? Then: private void

Action<> multiple parameters syntax clarification

梦想与她 提交于 2020-05-26 12:46:49
问题 Sometimes I can't understand the simplest things, i'm sure it's in my face, i just fail to see it. Im trying to create a delegate for a method in this simple class: public static class BalloonTip { public static BalloonType BalType { get; set; } public static void ShowBalloon(string message, BalloonType bType) { // notify user } } Now, this Action<> is supposed to create the delegate without actually declaring one with the keyword "delegate", did I understand correctly? Then: private void

What is the size of the icons in the system tray? [duplicate]

青春壹個敷衍的年華 提交于 2020-05-10 03:34:08
问题 This question already has answers here : Best Icon size for displaying in the tray (3 answers) Closed 2 years ago . I want to change the notification icon of my application but don't know what is the size so as to make it properly displayed. Currently it is automatically resized and break my pixels! Please help! 回答1: It's 16x16. If you create a .ico file that supports 16, 32, 48 and 256 sizes, you're covered. 回答2: In fact the size of the icon will vary according to the system DPI. WPF exposes

NotifyIcon not showing

耗尽温柔 提交于 2020-01-29 05:40:06
问题 I am writing a simple application that I would like to control with a notifyIcon rather than a form, I have follwed examples I found through Google, but my notifyIcon will not show up. What am I doing wrong? static class MainEntryClass { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); C2F TestApp = new C2F(); Application.Run(); TestApp.Dispose(); } } class C2F {

TaskbarIcon will not show balloon tip with custom icon

独自空忆成欢 提交于 2020-01-23 11:58:26
问题 I have created a WPF app which is using WPF NotifyIcon. I am unable to get the ShowBalloonTip method to work with a custom Icon. I have tried like this: _icon.ShowBalloonTip("Title", "Message", new Icon("Icons/accept.ico")); Any idea how I can get a notification to work with a custom icon? (Using the built in icons works fine - i.e. using BalloonIcon). 回答1: Try using the "Large Icon" overload. _icon.ShowBalloonTip("Title", "Message", new Icon("Icons/accept.ico"), largeIcon: true); This worked

Writing text to the system tray instead of an icon

旧时模样 提交于 2020-01-22 10:45:28
问题 I am trying to display 2-3 updatable characters in the system tray rather than display an .ico file - similar to what CoreTemp does when they display the temperature in the system try: I am using a NotifyIcon in my WinForms application along with the following code: Font fontToUse = new Font("Microsoft Sans Serif", 8, FontStyle.Regular, GraphicsUnit.Pixel); Brush brushToUse = new SolidBrush(Color.White); Bitmap bitmapText = new Bitmap(16, 16); Graphics g = Drawing.Graphics.FromImage