aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/Tools.cs
diff options
context:
space:
mode:
authorAShifter <[email protected]>2017-10-01 08:23:50 -0600
committerAShifter <[email protected]>2017-10-01 08:23:50 -0600
commit46fe7eb7098dd31b186e13e228fede07c46ee064 (patch)
treee6fbc5ac67890b11293f682c279ff7670ecef8cf /ShiftOS.Engine/Tools.cs
parentf5004702c46d6c99737a0519d7d6735307c7501a (diff)
parentf2ed0c673c2d3f0e021b0307a22792af66fd217d (diff)
downloadshiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.tar.gz
shiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.tar.bz2
shiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.zip
Merge remote-tracking branch 'refs/remotes/ShiftOS-Rewind/master'
Diffstat (limited to 'ShiftOS.Engine/Tools.cs')
-rw-r--r--ShiftOS.Engine/Tools.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/ShiftOS.Engine/Tools.cs b/ShiftOS.Engine/Tools.cs
new file mode 100644
index 0000000..792ccef
--- /dev/null
+++ b/ShiftOS.Engine/Tools.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace ShiftOS.Engine
+{
+ /// <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 extern static bool DestroyIcon(IntPtr handle);
+
+ public static Icon ToIcon(this Bitmap bm)
+ {
+ Icon tempicon = Icon.FromHandle(bm.GetHicon());
+
+ Icon newIcon = tempicon.Clone() as Icon;
+
+ //for some reason this exists
+ DestroyIcon(tempicon.Handle);
+
+ return newIcon;
+ }
+ }
+}