"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Can I Dynamically Change a NotifyIcon's Icon in .NET Using Resources?

How Can I Dynamically Change a NotifyIcon's Icon in .NET Using Resources?

Published on 2025-01-30
Browse:339

How Can I Dynamically Change a NotifyIcon's Icon in .NET Using Resources?

Create and use resources in the .NET

Effectively quoting and using the resources of different programs are essential. This article discusses a common scene: dynamically change the notifyicon icon according to the program status.

Create Resources

Create icon resources:

Right -click the project in the solution resource manager and select "Properties".

Transfer to the "Resource" tab.

    Click the first button and then select "icon".
  1. Use the "Add Resource" to add the required icons.
  2. Double -click the additional resource to edit.
  3. Use resources
  4. Use Properties.Resources Static class to access resources. The following code dynamic settings notifyicon icon:

pased =! Paused; if (Paused) notifyicon.icon = Properties.RSources.redicon; else notifyicon.icon = Properties.RSources.greenicon; This method simplifies resource visits and operations, so as to effectively achieve complex programming logic.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3