Geralds Thought Shed

Gedanken zu .Net, C#, Java, Windows, Linux, Mobile-Life und mehr….

C# – Bitmap (jpg, png) als Icon für das NotifyIcon-Element

Verfasst von Gerald Huber am Samstag, 5. Januar 2008

Ich wurde gestern wieder einmal gefragt, wie man ein NotifyIcon-Element bei .NET ein Bitmap-Image als Icon übergeben kann.

Eigentlich ist es ganz einfach, wenn man es weiß ;-)

// Here is our notifyIcon
NotifyIcon myNotifyIcon;
this.myNotifyIcon = new NotifyIcon(this.components);

// now we convert the Bitmap image in an icon
Icon icon = Icon.FromHandle(((Bitmap)Image.FromFile("Resources/Settings.png")).GetHicon());
this.myNotifyIcon.Icon = icon;

Eine Antwort zu “C# – Bitmap (jpg, png) als Icon für das NotifyIcon-Element”

  1. Timo sagte

    Danke für den Tipp!

Eine Antwort schreiben

XHTML: Du kannst diese Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>