From 9a9ec274d32b78291c9ca489a0cc7ce45e85907e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 4 Feb 2017 13:59:31 -0500 Subject: [PATCH] Sorta-working custom cursors. --- .../Properties/Resources.Designer.cs | 10 ++++++++++ ShiftOS.WinForms/Properties/Resources.resx | 3 +++ ShiftOS.WinForms/Resources/DefaultMouse.bmp | Bin 0 -> 3382 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/Tools/ControlManager.cs | 10 +++++++++- ShiftOS_TheReturn/Skinning.cs | 8 ++++++++ 6 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 ShiftOS.WinForms/Resources/DefaultMouse.bmp diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 1d949f8..7fc4cd7 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -250,6 +250,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap DefaultMouse { + get { + object obj = ResourceManager.GetObject("DefaultMouse", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 72532bb..8efe1d1 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -265,4 +265,7 @@ ..\Resources\ShiftOS.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\DefaultMouse.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/DefaultMouse.bmp b/ShiftOS.WinForms/Resources/DefaultMouse.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9ae6143520472ac6d2ed71ffebeb80a267f2536b GIT binary patch literal 3382 zcmeH@F%H5o3`N7p(wUKw6Z8P=y*2lOxaCWh^_|2hU63ugalXG_TR*q;TJ~7$^HKBm z%}cr0>WJ4;iX`Iwhf)8{{VVAqT~nvgnnzF0U&CW~dh|V-gYVQ@lxO{##cJ!1-Wii= zQ7-(9)zdILa`srZKf=@=JKwtNxzW1C)4fri^=XDz+nLDSV?vLxm=_#&GJjNKT+wC) igEq^v!^Uq*|e-=Brxq;k3ZXh>sY~TX{LT^w2 literal 0 HcmV?d00001 diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index adfabe9..d86e502 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -464,6 +464,7 @@ + diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 78d3534..8eba773 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -138,8 +138,16 @@ namespace ShiftOS.WinForms.Tools public static void SetupControl(Control ctrl) { - + var mouse = SkinEngine.GetImage("mouse"); + if (mouse == null) + mouse = Properties.Resources.DefaultMouse; + + var mBmp = new Bitmap(mouse); + var gfx = Graphics.FromImage(mBmp); + var handle = mBmp.GetHicon(); + + ctrl.Cursor = new Cursor(handle); if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) { string tag = ""; diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index b3dddd3..d6af165 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -152,6 +152,14 @@ namespace ShiftOS.Engine { [ShifterName("System Font")] [ShifterDescription("The font style used by the system.")] public Font MainFont = SysFont; + + [Image("mouse")] + [ShifterMeta("System")] + [ShifterCategory("General")] + [ShifterName("Mouse image")] + [ShifterDescription("Select an image to be displayed as the system mouse cursor.")] + [RequiresUpgrade("skinning")] + public byte[] MouseCursorImage = null; [ShifterEnumMask(new[] { "Right", "Left"})] [ShifterMeta("Windows")]