Last active
August 29, 2015 14:02
-
-
Save zonaryFUND/71b54517056929fa31e0 to your computer and use it in GitHub Desktop.
Registers Unity's Texture2D as an icon of System.Windows.Fomrs.Notifyicon (requires mono dll)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Windows.Forms; | |
public class WindowsNotifyIcon { | |
NotifyIcon notifyIcon; | |
public void RegisterNotifyIcon(Texture2D iconTexture) { | |
notifyIcon = new NotifyIcon(); | |
MemoryStream memStream = new MemoryStream(iconTexture.EncodeToPNG()); | |
memStream.Seek(0, SeekOrigin.Begin); | |
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(memStream); | |
notifyIcon.Icon = System.Drawing.Icon.FromHandle(bitmap.GetHicon()); | |
notifyIcon.Visible = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment