Can I change my programs tray icon while it runs in c#? - c#

I want to make my programs tray icon change colors if a certain event occurs. Can I set my code to change the tray icon while it runs?

Just set the NotifyIcon.Icon property to the new icon to change it.

Related

Place an application's icon into system tray

I'm making a desktop mascot with unity, and I do not want to see the icon appearing on the task bar, I want the icon in the system tray. Is there a way to do this?
PS: This is NOT a windows form (it's a game), so I believe Form.ShowInTaskbar will not work.
I've never programmed in Unity, but I'm assuming you are working in a Windows window. If you make the top level window for the application not appear in the main area of the Taskbar, make the window a "Tool Window" (by setting the WS_EX_TOOLWINDOW extended style on the window), then the window/app will not show up on the taskbar.
I'll leave it to someone how knows enough Unity to tell you how to set that style. Here's a reference to start with (on the Windows side, not the Unity side): Managing Taskbar Buttons

Blink tray icon in tray application (C# windows form)

I created one tray application. It's icon will be change based on condition.
At one point I want functionality in which my icon should be blink like it can be gif.

Window which points to the system tray

Is it possible to create a Window which "points" to the system tray icon which was clicked to invoke it? I don't know what the arrow is called so I am attaching a picture to make myself clearer. WPF does not support notification icons so the system tray icon is created using System.Windows.Forms.NotifyIcon.

Changing style of the system tray icon at run time

I've created a system tray application using c#. And it is running successfully. Now the problem is, a notification window that has to be popped up when a particular event occurs(Not with a new icon but for the same icon which present in the notification area). The notification should last for few seconds and the notification area icon's colour should be changed till the window disappears.
Please suggest solutions. Thanks for helping!!!
If you use the class NotifyIcon you can set the Icon property:
notifyIcon.Icon = <Some Icon> (ex. Properties.Resources.IconRed, if in your resources).

How to define single icon for main window and exe file?

Usually I have to set 2 different icons. One in the project's settings tab, and one to the Icon property of main window. Is there a way to define single icon for the whole application (all windows and exe)?
Update: to be more concrete. I have app that is 100kb in size. I want to embed icon that is 300kb in size and want my app to be 400kb instead of 700
You need to set the icon in you project's properties:
For taskbar you need to change your main window's Icon:
When you set your exe icon, WPF will use that for all Windows you create. However, it doesn't do it in debug mode - that's because the "entry point" for your process is the .vshost.exe, not your exe. But if you use Ctrl+F5 (run without debugging), you should find all Windows get the exe icon. You shouldn't have to set it on each Window.
To make it work properly in debug mode, I generally set up a Style which I apply to each window, which sets the application icon.

Categories

Resources