Orange Light
Orange Light

Reputation: 13

How to change notifyIcon1 icon in code

This is what I have so far:

if (label1.Text == "On")
{
  notifyIcon1.Icon = Image.FromFile("@C:\Users\Alex\Downloads\On.ico");
}

What do I do make the icon equal to change it?

Upvotes: 1

Views: 529

Answers (1)

FrostyFire
FrostyFire

Reputation: 3258

This should work: Aside from the obvious, I put the @ before the quotes. It may not matter, just the way I do it.

notifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon(@"C:\Users\Alex\Downloads\On.ico");

You this helps you!

Upvotes: 2

Related Questions