diff options
| author | John T <[email protected]> | 2017-11-05 18:47:46 -0500 |
|---|---|---|
| committer | John T <[email protected]> | 2017-11-05 18:47:46 -0500 |
| commit | a10440a45c40652b13e883aec832a0c8ded685e8 (patch) | |
| tree | ab64311e47f8e59c7c46cd50c94bec424165ecc2 /ShiftOS.Engine/Misc/Tools.cs | |
| parent | 019da5b9ebf67b758a31dd05c4b17de66fa682f2 (diff) | |
| download | shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.tar.gz shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.tar.bz2 shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.zip | |
Added a half-complete ShiftFS and did some code cleanup
Diffstat (limited to 'ShiftOS.Engine/Misc/Tools.cs')
| -rw-r--r-- | ShiftOS.Engine/Misc/Tools.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ShiftOS.Engine/Misc/Tools.cs b/ShiftOS.Engine/Misc/Tools.cs new file mode 100644 index 0000000..6430084 --- /dev/null +++ b/ShiftOS.Engine/Misc/Tools.cs @@ -0,0 +1,29 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace ShiftOS.Engine.Misc +{ + /// <summary> + /// Random class full of unassorted [but also uncategorizable] tools. + /// </summary> + public static class Tools + { + public static Random Rnd = new Random(); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern bool DestroyIcon(IntPtr handle); + + public static Icon ToIcon(this Bitmap bm) + { + var tempicon = Icon.FromHandle(bm.GetHicon()); + + var newIcon = tempicon.Clone() as Icon; + + //for some reason this exists + DestroyIcon(tempicon.Handle); + + return newIcon; + } + } +}
\ No newline at end of file |
