aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/Tools.cs
diff options
context:
space:
mode:
authorJohn T <[email protected]>2017-09-27 18:32:16 -0400
committerJohn T <[email protected]>2017-09-27 18:32:16 -0400
commita25baf08203237fc2eeeb4b7ca720f7d47f8a666 (patch)
tree2664b08ca0f9b57ed0a9240ab54441ece6ac2d71 /ShiftOS.Engine/Tools.cs
parentdc7533184a88271bfd2a3aae299532ec7632144d (diff)
downloadshiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.tar.gz
shiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.tar.bz2
shiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.zip
added desktop and some small additions and changes to shiftwm
Diffstat (limited to 'ShiftOS.Engine/Tools.cs')
-rw-r--r--ShiftOS.Engine/Tools.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/ShiftOS.Engine/Tools.cs b/ShiftOS.Engine/Tools.cs
new file mode 100644
index 0000000..eca7b59
--- /dev/null
+++ b/ShiftOS.Engine/Tools.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+using ImageMagick;
+
+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;
+ }
+ }
+}