diff --git a/TileIconifier.Core/Custom/Steam/KeyValues/KeyValues.cs b/TileIconifier.Core/Custom/Steam/KeyValues/KeyValues.cs index 0b665a0..4c97c54 100644 --- a/TileIconifier.Core/Custom/Steam/KeyValues/KeyValues.cs +++ b/TileIconifier.Core/Custom/Steam/KeyValues/KeyValues.cs @@ -260,8 +260,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (KeyValues)) return false; - return Equals((KeyValues) obj); + return obj is KeyValues && Equals((KeyValues) obj); } /// @@ -510,7 +509,7 @@ public bool ExistsSubKey(string subKeyName) /// Current Line to parse. /// True if Key have quotes " so is not a { or }. /// True if Current line is a comment. - private static KeyValuePair ReadToken(string line, ref bool wasQuoted, ref bool wasComment) + private static KeyValuePair ReadToken(string line, out bool wasQuoted, out bool wasComment) { wasQuoted = false; wasComment = false; @@ -624,11 +623,11 @@ private static KeyValuePair ReadToken(string line, ref bool wasQ private uint RetriveIndex(List lines, string search, uint startIndex) { if (string.IsNullOrEmpty(search)) return 0; - var wasQuote = false; - var wasComment = false; for (var i = (int) startIndex; i < lines.Count; i++) { - var kvPair = ReadToken(lines[i], ref wasQuote, ref wasComment); + bool wasQuote; + bool wasComment; + var kvPair = ReadToken(lines[i], out wasQuote, out wasComment); if (kvPair.Key == search && !wasComment && !wasQuote) return (uint) i; } @@ -663,14 +662,14 @@ public bool LoadFromFile(string fileName) private bool LoadFromList(List stream, uint startPos, ref uint endPos) { if (stream == null) return false; - var wasQuoted = false; - var wasComment = false; string lastComment = null; var wasName = false; endPos = 0; for (var i = startPos; i < stream.Count; i++) { - var kvPair = ReadToken(stream[(int) i], ref wasQuoted, ref wasComment); + bool wasQuoted; + bool wasComment; + var kvPair = ReadToken(stream[(int) i], out wasQuoted, out wasComment); if (string.IsNullOrEmpty(kvPair.Key)) continue; endPos = i; // Is the end of KeyValues Class? diff --git a/TileIconifier.Core/IconExtractor/IconExtractor.cs b/TileIconifier.Core/IconExtractor/IconExtractor.cs index 4d26cd2..60b922a 100644 --- a/TileIconifier.Core/IconExtractor/IconExtractor.cs +++ b/TileIconifier.Core/IconExtractor/IconExtractor.cs @@ -42,9 +42,9 @@ public class IconExtractor // Flags for LoadLibraryEx(). - private const uint LoadLibraryAsDatafile = 0x00000002; + private const uint LOAD_LIBRARY_AS_DATAFILE = 0x00000002; - private const int MaxPath = 260; + private const int MAX_PATH = 260; // Resource types for EnumResourceNames(). @@ -119,7 +119,7 @@ private void Initialize(string fileName) var hModule = IntPtr.Zero; try { - hModule = NativeMethods.LoadLibraryEx(fileName, IntPtr.Zero, LoadLibraryAsDatafile); + hModule = NativeMethods.LoadLibraryEx(fileName, IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); if (hModule == IntPtr.Zero) throw new Win32Exception(); @@ -228,7 +228,7 @@ private string GetFileName(IntPtr hModule) string fileName; { - var buf = new StringBuilder(MaxPath); + var buf = new StringBuilder(MAX_PATH); var len = NativeMethods.GetMappedFileName( NativeMethods.GetCurrentProcess(), hModule, buf, buf.Capacity); if (len == 0) @@ -243,7 +243,7 @@ private string GetFileName(IntPtr hModule) for (var c = 'A'; c <= 'Z'; ++c) { var drive = c + ":"; - var buf = new StringBuilder(MaxPath); + var buf = new StringBuilder(MAX_PATH); var len = NativeMethods.QueryDosDevice(drive, buf, buf.Capacity); if (len == 0) continue; diff --git a/TileIconifier.Core/Utilities/ShortcutUtils.cs b/TileIconifier.Core/Utilities/ShortcutUtils.cs index 956bd74..1e944fb 100644 --- a/TileIconifier.Core/Utilities/ShortcutUtils.cs +++ b/TileIconifier.Core/Utilities/ShortcutUtils.cs @@ -105,13 +105,13 @@ public static void CreateLnkFile(string shortcutPath, string targetPath, string private static string ResolveMsiShortcut(string file) { - var product = new StringBuilder(NativeMethods.MaxGuidLength + 1); - var feature = new StringBuilder(NativeMethods.MaxFeatureLength + 1); - var component = new StringBuilder(NativeMethods.MaxGuidLength + 1); + var product = new StringBuilder(NativeMethods.MAX_GUID_LENGTH + 1); + var feature = new StringBuilder(NativeMethods.MAX_FEATURE_LENGTH + 1); + var component = new StringBuilder(NativeMethods.MAX_GUID_LENGTH + 1); NativeMethods.MsiGetShortcutTarget(file, product, feature, component); - var pathLength = NativeMethods.MaxPathLength; + var pathLength = NativeMethods.MAX_PATH_LENGTH; var path = new StringBuilder(pathLength); var installState = NativeMethods.MsiGetComponentPath(product.ToString(), component.ToString(), path, @@ -139,9 +139,9 @@ public enum InstallState Default = 5*/ } - public const int MaxFeatureLength = 38; - public const int MaxGuidLength = 38; - public const int MaxPathLength = 1024; + public const int MAX_FEATURE_LENGTH = 38; + public const int MAX_GUID_LENGTH = 38; + public const int MAX_PATH_LENGTH = 1024; [DllImport("msi.dll", CharSet = CharSet.Unicode)] public static extern uint MsiGetShortcutTarget(string targetFile, StringBuilder productCode, diff --git a/TileIconifier/Controls/AllOrCurrentUserRadios.Designer.cs b/TileIconifier/Controls/AllOrCurrentUserRadios.Designer.cs index 36bb007..4999158 100644 --- a/TileIconifier/Controls/AllOrCurrentUserRadios.Designer.cs +++ b/TileIconifier/Controls/AllOrCurrentUserRadios.Designer.cs @@ -35,7 +35,7 @@ private void InitializeComponent() // // radAllUsers // - this.radAllUsers.AutoSize = true; + this.radAllUsers.AutoSize = false; this.radAllUsers.Checked = true; this.radAllUsers.Location = new System.Drawing.Point(6, 22); this.radAllUsers.Name = "radAllUsers"; @@ -47,7 +47,7 @@ private void InitializeComponent() // // lblHeader // - this.lblHeader.AutoSize = true; + this.lblHeader.AutoSize = false; this.lblHeader.Location = new System.Drawing.Point(3, 0); this.lblHeader.Name = "lblHeader"; this.lblHeader.Size = new System.Drawing.Size(68, 13); @@ -56,7 +56,7 @@ private void InitializeComponent() // // radCurrentUser // - this.radCurrentUser.AutoSize = true; + this.radCurrentUser.AutoSize = false; this.radCurrentUser.Location = new System.Drawing.Point(6, 45); this.radCurrentUser.Name = "radCurrentUser"; this.radCurrentUser.Size = new System.Drawing.Size(84, 17); @@ -67,7 +67,7 @@ private void InitializeComponent() // AllOrCurrentUserRadios // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.radCurrentUser); this.Controls.Add(this.lblHeader); this.Controls.Add(this.radAllUsers); diff --git a/TileIconifier/Controls/Eyedropper/EyedropColorPicker.cs b/TileIconifier/Controls/Eyedropper/EyedropColorPicker.cs new file mode 100644 index 0000000..87366d1 --- /dev/null +++ b/TileIconifier/Controls/Eyedropper/EyedropColorPicker.cs @@ -0,0 +1,154 @@ +/* + The original source for this control was created by jkristia @ http://www.codeproject.com/Articles/21965/Color-Picker-with-Color-Wheel-and-Eye-Dropper + licenced under The Code Project Open License (CPOL). + + Minor modifications have been made to fit in with the requirements of this application: + + - Image for eyedropper altered + - Border removed + + - Changed some variable names and cleaned up to fit with coding practices throughout this solution +*/ + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; +using TileIconifier.Core.Utilities; +using TileIconifier.Properties; + +namespace TileIconifier.Controls.Eyedropper +{ + internal sealed class EyedropColorPicker : Control + { + private readonly Bitmap _mIcon; + + private bool _iscapturing; + + private Bitmap _mSnapshot; + private float _mZoom = 4; + + public EyedropColorPicker() + { + DoubleBuffered = true; + var eyedropperIcon = new Bitmap(Resources.Actions_color_picker_black_icon); + _mIcon = ImageUtils.ResizeImage(eyedropperIcon, 20, 20); + eyedropperIcon.Dispose(); + } + + public int Zoom + { + get { return (int) _mZoom; } + set + { + _mZoom = value; + RecalcSnapshotSize(); + } + } + + public Color SelectedColor { get; set; } + + private RectangleF ImageRect => Util.Rect(ClientRectangle); + public event EventHandler SelectedColorChanged; + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + RecalcSnapshotSize(); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + if (_mSnapshot == null) return; + e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; + var r = RectangleF.Empty; + r.Width = _mSnapshot.Size.Width*Zoom; + r.Height = _mSnapshot.Size.Height*Zoom; + r.X = 0; + r.Y = 0; + e.Graphics.DrawImage(_mSnapshot, r); + + if (_iscapturing) + { + var center = Util.Center(r); + var centerrect = new Rectangle(Util.Point(center), new Size(0, 0)); + centerrect.X -= Zoom/2 - 1; + centerrect.Y -= Zoom/2 - 1; + centerrect.Width = Zoom; + centerrect.Height = Zoom; + e.Graphics.DrawRectangle(Pens.Black, centerrect); + } + else + { + const int offset = 3; + + e.Graphics.FillRectangle(SystemBrushes.Control, new Rectangle(new Point(0, 0), Size)); + e.Graphics.DrawImage(_mIcon, offset, offset); + } + // + //draws a border - removed for now. + // + //var rr = ClientRectangle; + //Pen pen = new Pen(BackColor, 3); + //rr.Inflate(-1, -1); + //e.Graphics.DrawRectangle(pen, rr); + //Util.DrawFrame(e.Graphics, rr, 6, Color.CadetBlue); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return; + Cursor = Cursors.Cross; + _iscapturing = true; + Invalidate(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + if ((e.Button & MouseButtons.Left) == MouseButtons.Left) + GetSnapshot(); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + { + Cursor = Cursors.Arrow; + _iscapturing = false; + Invalidate(); + } + } + + private void RecalcSnapshotSize() + { + _mSnapshot?.Dispose(); + var r = ImageRect; + var w = (int) Math.Floor(r.Width/Zoom); + var h = (int) Math.Floor(r.Height/Zoom); + _mSnapshot = new Bitmap(w, h); + } + + private void GetSnapshot() + { + var p = MousePosition; + p.X -= _mSnapshot.Width/2; + p.Y -= _mSnapshot.Height/2; + + using (var dc = Graphics.FromImage(_mSnapshot)) + { + dc.CopyFromScreen(p, new Point(0, 0), _mSnapshot.Size); + Refresh(); //Invalidate(); + + var center = Util.Center(new RectangleF(0, 0, _mSnapshot.Size.Width, _mSnapshot.Size.Height)); + var c = _mSnapshot.GetPixel((int) Math.Round(center.X), (int) Math.Round(center.Y)); + if (c == SelectedColor) return; + SelectedColor = c; + SelectedColorChanged?.Invoke(this, null); + } + } + } +} \ No newline at end of file diff --git a/TileIconifier/Controls/Eyedropper/Util.cs b/TileIconifier/Controls/Eyedropper/Util.cs new file mode 100644 index 0000000..88ce931 --- /dev/null +++ b/TileIconifier/Controls/Eyedropper/Util.cs @@ -0,0 +1,318 @@ +/* + The original source for this control was created by jkristia @ http://www.codeproject.com/Articles/21965/Color-Picker-with-Color-Wheel-and-Eye-Dropper + licenced under The Code Project Open License (CPOL). + + Minor modifications have been made to fit in with the requirements of this application: + + - Changed some variable names and cleaned up to fit with coding practices throughout this solution +*/ + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace TileIconifier.Controls.Eyedropper +{ + internal class Util + { + public static Rectangle Rect(RectangleF rf) + { + var r = new Rectangle + { + X = (int) rf.X, + Y = (int) rf.Y, + Width = (int) rf.Width, + Height = (int) rf.Height + }; + return r; + } + public static RectangleF Rect(Rectangle r) + { + var rf = new RectangleF + { + X = r.X, + Y = r.Y, + Width = r.Width, + Height = r.Height + }; + return rf; + } + public static Point Point(PointF pf) + { + return new Point((int)pf.X, (int)pf.Y); + } + public static PointF Center(RectangleF r) + { + var center = r.Location; + center.X += r.Width / 2; + center.Y += r.Height / 2; + return center; + } + + public static void DrawFrame(Graphics dc, RectangleF r, float cornerRadius, Color color) + { + var pen = new Pen(color); + if (cornerRadius <= 0) + { + dc.DrawRectangle(pen, Rect(r)); + return; + } + cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Width) - 2); + cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Height) - 2); + + var path = new GraphicsPath(); + path.AddArc(r.X, r.Y, cornerRadius, cornerRadius, 180, 90); + path.AddArc(r.Right - cornerRadius, r.Y, cornerRadius, cornerRadius, 270, 90); + path.AddArc(r.Right - cornerRadius, r.Bottom - cornerRadius, cornerRadius, cornerRadius, 0, 90); + path.AddArc(r.X, r.Bottom - cornerRadius, cornerRadius, cornerRadius, 90, 90); + path.CloseAllFigures(); + dc.DrawPath(pen, path); + } + public static void Draw2ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2) + { + var lr1 = r; + float angle = 0; + + if (orientation == Orientation.Vertical) + angle = 270; + if (orientation == Orientation.Horizontal) + angle = 0; + + if (!(lr1.Height > 0) || !(lr1.Width > 0)) return; + var lb1 = new LinearGradientBrush(lr1, c1, c2, angle, false); + dc.FillRectangle(lb1, lr1); + lb1.Dispose(); + } + public static void Draw3ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2, Color c3) + { + // to draw a 3 color bar 2 gradient brushes are needed + // one from c1 - c2 and c2 - c3 + var lr1 = r; + var lr2 = r; + float angle = 0; + + if (orientation == Orientation.Vertical) + { + angle = 270; + + lr1.Height = lr1.Height / 2; + lr2.Height = r.Height - lr1.Height; + lr2.Y += lr1.Height; + } + if (orientation == Orientation.Horizontal) + { + angle = 0; + + lr1.Width = lr1.Width / 2; + lr2.Width = r.Width - lr1.Width; + lr1.X = lr2.Right; + } + + if (lr1.Height > 0 && lr1.Width > 0) + { + var lb2 = new LinearGradientBrush(lr2, c1, c2, angle, false); + var lb1 = new LinearGradientBrush(lr1, c2, c3, angle, false); + + dc.FillRectangle(lb1, lr1); + dc.FillRectangle(lb2, lr2); + + lb1.Dispose(); + lb2.Dispose(); + } + // with some sizes the first pixel in the gradient rectangle shows the opposite color + // this is a workaround for that problem + Pen pc2; + Pen pc3; + if (orientation == Orientation.Vertical) + { + pc2 = new Pen(c2, 1); + pc3 = new Pen(c3, 1); + dc.DrawLine(pc3, lr1.Left, lr1.Top, lr1.Right - 1, lr1.Top); + dc.DrawLine(pc2, lr2.Left, lr2.Top, lr2.Right - 1, lr2.Top); + pc2.Dispose(); + pc3.Dispose(); + } + + if (orientation != Orientation.Horizontal) return; + + var pc1 = new Pen(c1, 1); + pc2 = new Pen(c2, 1); + pc3 = new Pen(c3, 1); + dc.DrawLine(pc1, lr2.Left, lr2.Top, lr2.Left, lr2.Bottom - 1); + dc.DrawLine(pc2, lr2.Right, lr2.Top, lr2.Right, lr2.Bottom - 1); + dc.DrawLine(pc3, lr1.Right, lr1.Top, lr1.Right, lr1.Bottom - 1); + pc1.Dispose(); + pc2.Dispose(); + pc3.Dispose(); + } + } + + internal class NativeMethods + { + public const int WM_KEYDOWN = 0x0100; + public const int WM_KEYUP = 0x0101; + public const int WM_CHAR = 0x0102; + + public const int SWP_NOSIZE = 0x0001; + public const int SWP_NOMOVE = 0x0002; + public const int SWP_NOZORDER = 0x0004; + public const int SWP_NOREDRAW = 0x0008; + public const int SWP_NOACTIVATE = 0x0010; + public const int SWP_FRAMECHANGED = 0x0020; /* The frame changed: send WM_NCCALCSIZE */ + public const int SWP_SHOWWINDOW = 0x0040; + public const int SWP_HIDEWINDOW = 0x0080; + public const int SWP_NOCOPYBITS = 0x0100; + public const int SWP_NOOWNERZORDER = 0x0200; /* Don't do owner Z ordering */ + public const int SWP_NOSENDCHANGING = 0x0400; /* Don't send WM_WINDOWPOSCHANGING */ + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] + public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags); + + public const uint WS_OVERLAPPED = WS_BORDER | WS_CAPTION; + public const uint WS_CLIPSIBLINGS = 0x04000000; + public const uint WS_CLIPCHILDREN = 0x02000000; + public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */ + public const uint WS_BORDER = 0x00800000; + public const uint WS_DLGFRAME = 0x00400000; + public const uint WS_VSCROLL = 0x00200000; + public const uint WS_HSCROLL = 0x00100000; + public const uint WS_SYSMENU = 0x00080000; + public const uint WS_THICKFRAME = 0x00040000; + public const uint WS_MAXIMIZEBOX = 0x00020000; + public const uint WS_MINIMIZEBOX = 0x00010000; + public const uint WS_SIZEBOX = WS_THICKFRAME; + public const uint WS_POPUP = 0x80000000; + public const uint WS_CHILD = 0x40000000; + public const uint WS_VISIBLE = 0x10000000; + public const uint WS_DISABLED = 0x08000000; + + public const uint WS_EX_DLGMODALFRAME = 0x00000001; + public const uint WS_EX_TOPMOST = 0x00000008; + public const uint WS_EX_TOOLWINDOW = 0x00000080; + public const uint WS_EX_WINDOWEDGE = 0x00000100; + public const uint WS_EX_CLIENTEDGE = 0x00000200; + + public const uint WS_EX_CONTEXTHELP = 0x00000400; + public const uint WS_EX_STATICEDGE = 0x00020000; + public const uint WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; + + public const int GWL_STYLE = -16; + public const int GWL_EXSTYLE = -20; + + [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)] + public static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex); + + [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)] + public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, int dwNewLong); + + + public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); + + public const int WH_KEYBOARD = 2; + public const int WH_MOUSE = 7; + public const int WH_KEYBOARD_LL = 13; + public const int WH_MOUSE_LL = 14; + + /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); + + /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + public static extern bool UnhookWindowsHookEx(int idHook); + + /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam); + + //Declare the wrapper managed POINT class. + [StructLayout(LayoutKind.Sequential)] + public class ManagedPoint + { + public int x; + public int y; + } + + //Declare the wrapper managed MouseHookStruct class. + [StructLayout(LayoutKind.Sequential)] + public class MouseHookStruct + { + public ManagedPoint pt; + public int hwnd; + public int wHitTestCode; + public int dwExtraInfo; + } + + //Declare the wrapper managed KeyboardHookStruct class. + [StructLayout(LayoutKind.Sequential)] + public class KeyboardHookStruct + { + public int vkCode; + public int scanCode; + public int flags; + public int time; + public int dwExtraInfo; + } + } + + + /// http://support.microsoft.com/kb/318804 + /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp + /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp + /// http://www.codeproject.com/KB/cs/globalhook.aspx + public class Hook + { + public delegate void KeyboardDelegate(KeyEventArgs e); + public KeyboardDelegate OnKeyDown; + int _mHHook; + NativeMethods.HookProc _mHookCallback; + + public void SetHook(bool enable) + { + if (enable && _mHHook == 0) + { + _mHookCallback = HookCallbackProc; + var module = Assembly.GetExecutingAssembly().GetModules()[0]; + _mHHook = NativeMethods.SetWindowsHookEx(NativeMethods.WH_KEYBOARD_LL, _mHookCallback, Marshal.GetHINSTANCE(module), 0); + if (_mHHook != 0) return; + MessageBox.Show(@"SetHook Failed. Please make sure the 'Visual Studio Host Process' on the debug setting page is disabled"); + return; + } + + if (enable || _mHHook == 0) return; + NativeMethods.UnhookWindowsHookEx(_mHHook); + _mHHook = 0; + } + + private int HookCallbackProc(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode < 0) + { + return NativeMethods.CallNextHookEx(_mHHook, nCode, wParam, lParam); + } + //Marshall the data from the callback. + var hookstruct = (NativeMethods.KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(NativeMethods.KeyboardHookStruct)); + + if (OnKeyDown != null && wParam.ToInt32() == NativeMethods.WM_KEYDOWN) + { + var key = (Keys)hookstruct.vkCode; + if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) + key |= Keys.Shift; + if ((Control.ModifierKeys & Keys.Control) == Keys.Control) + key |= Keys.Control; + + var e = new KeyEventArgs(key) {Handled = false}; + OnKeyDown(e); + if (e.Handled) + return 1; + } + var result = 0; + if (_mHHook != 0) + result = NativeMethods.CallNextHookEx(_mHHook, nCode, wParam, lParam); + return result; + } + } +} diff --git a/TileIconifier/Controls/PictureBox/PannablePictureBox.Designer.cs b/TileIconifier/Controls/PictureBox/PannablePictureBox.Designer.cs index 01f66ef..ba1deca 100644 --- a/TileIconifier/Controls/PictureBox/PannablePictureBox.Designer.cs +++ b/TileIconifier/Controls/PictureBox/PannablePictureBox.Designer.cs @@ -53,7 +53,7 @@ private void InitializeComponent() // PannablePictureBox // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.pctBox); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "PannablePictureBox"; diff --git a/TileIconifier/Controls/PictureBox/PannablePictureBox.cs b/TileIconifier/Controls/PictureBox/PannablePictureBox.cs index 187b4ac..1018cb9 100644 --- a/TileIconifier/Controls/PictureBox/PannablePictureBox.cs +++ b/TileIconifier/Controls/PictureBox/PannablePictureBox.cs @@ -47,6 +47,14 @@ public partial class PannablePictureBox : UserControl internal int MinHeight; internal int MinWidth; + public bool ShowTextOverlay = false; + public Color OverlayColor = Color.White; + public string TextOverlay; + + public Point TextOverlayPoint; + + private readonly Font _overlayFont = new Font(new FontFamily("Segoe UI"), 9f, FontStyle.Regular ); + public PannablePictureBoxImage PannablePictureBoxImage; public PannablePictureBox() @@ -152,17 +160,7 @@ private void pctBox_MouseDown(object sender, MouseEventArgs e) if (e.Button != MouseButtons.Left) return; _panning = true; - //if (PannablePictureBoxImage != null) - //{ - // if (_movingPoint.X + PannablePictureBoxImage.Width > pctBox.Width * 2) - // _movingPoint.X = pctBox.Width * 2 - PannablePictureBoxImage.Width; - // if (_movingPoint.X < -2 * pctBox.Width) - // _movingPoint.X = -2 * pctBox.Width; - // if (_movingPoint.Y + PannablePictureBoxImage.Height > pctBox.Height * 2) - // _movingPoint.Y = pctBox.Height * 2 - PannablePictureBoxImage.Height; - // if (_movingPoint.Y < -2 * pctBox.Height) - // _movingPoint.Y = -2 * pctBox.Height; - //} + pctBox.Invalidate(); _startingPoint = new Point(e.Location.X - _movingPoint.X, e.Location.Y - _movingPoint.Y); @@ -182,15 +180,6 @@ private void pctBox_MouseMove(object sender, MouseEventArgs e) _movingPoint = new Point(e.Location.X - _startingPoint.X, e.Location.Y - _startingPoint.Y); - //////enforce the width and height as a binding box - ////if (_movingPoint.X + PannablePictureBoxImage.Width > pctBox.Width) - //// _movingPoint.X = pctBox.Width - PannablePictureBoxImage.Width; - ////if (_movingPoint.Y + PannablePictureBoxImage.Height > pctBox.Height) - //// _movingPoint.Y = pctBox.Height - PannablePictureBoxImage.Height; - ////if (_movingPoint.X < 0) - //// _movingPoint.X = 0; - ////if (_movingPoint.Y < 0) - //// _movingPoint.Y = 0; if (_movingPoint.X + PannablePictureBoxImage.Width > MaxWidth*2) _movingPoint.X = MaxWidth*2 - PannablePictureBoxImage.Width; if (_movingPoint.Y + PannablePictureBoxImage.Height > MaxHeight*2) @@ -217,6 +206,11 @@ private void pctBox_Paint(object sender, PaintEventArgs e) SetResolution(PannablePictureBoxImage.Image, PannablePictureBoxImage.Width, PannablePictureBoxImage.Height), PannablePictureBoxImage.X, PannablePictureBoxImage.Y); + if (ShowTextOverlay) + { + DrawTextOverlay(e); + } + #if DEBUG e.Graphics.DrawString(PannablePictureBoxImage.Width + ", " + PannablePictureBoxImage.Height, DefaultFont, new SolidBrush(Color.Red), 0, 0); @@ -228,6 +222,116 @@ private void pctBox_Paint(object sender, PaintEventArgs e) #endif } + //not a fun mass of parsing. Attempts to closely match the label behaviour of the Windows 10 Start Menu. Haven't tested against Windows 8.1 + //probably fails in some instances... + private void DrawTextOverlay(PaintEventArgs e) + { + try + { + //get the width of the text before any manipulation + var textWidth = e.Graphics.MeasureString(TextOverlay, _overlayFont).Width; + //maximum length for a string, without spaces, to fit on the initial line - TODO: Pass these values in if there is ever a new tile type available + const int maxSingleLineLength = 94; + //maximum length of a line before truncating with ellipsis + const int ellipsisLength = 91; + + //function to loop through a line, removing a char at a time until the length satisfies the requirement + Func getCharsToMaxLength = (inputString, length) => + { + var textChunk = inputString; + do + { + textChunk = textChunk.Substring(0, textChunk.Length - 1); + } while (e.Graphics.MeasureString(textChunk, _overlayFont).Width > length); + return textChunk; + }; + + //if we have a space somewhere in the string and it's over the max single line length it will be split over two lines + if (textWidth >= maxSingleLineLength && TextOverlay.Contains(" ")) + { + //get the first chunk of data to process + var firstChunk = getCharsToMaxLength(TextOverlay, maxSingleLineLength); + + string firstLine; + string secondLine; + + //different handling whether there is a space in the first chunk or not. If there *is* a space, we will grab up until the last occurrance of a space character + //anything after that space character is put on the second line + // + //if there isn't a space in the first line, the entire chunk can be made the first line. The second line will start from where the first space character after this chunk is + //EXAMPLES + //1- XXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXX + //This should place XXXXX XXX on line one, and XXXXXXXXXXXXXXXXXXXXXXXXXX on line two + // + //2- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X + //This should place XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX on line one, and X on line two + if (firstChunk.Contains(" ")) + { + var lastSpaceIndex = firstChunk.LastIndexOf(" ", StringComparison.Ordinal); + firstLine = firstChunk.Substring(0, lastSpaceIndex).Trim(); + secondLine = TextOverlay.Substring(lastSpaceIndex, TextOverlay.Length - lastSpaceIndex).Trim(); + } + else + { + firstLine = firstChunk; + var tempSecondLine = + TextOverlay.Substring(firstChunk.Length, TextOverlay.Length - firstChunk.Length).Trim(); + var firstSpaceIndex = tempSecondLine.IndexOf(" ", StringComparison.Ordinal); + secondLine = + tempSecondLine.Substring(firstSpaceIndex, tempSecondLine.Length - firstSpaceIndex).Trim(); + } + + //compare each line to the ellipsis length - if exceeds, truncate with ... + //from previous examples above, we should now have: + //1. XXXXX XXX + // XXXXXXXXXX... + // + //2. XXXXXXXXXX... + // X + if (e.Graphics.MeasureString(firstLine, _overlayFont).Width > ellipsisLength) + firstLine = getCharsToMaxLength(firstLine, ellipsisLength) + "..."; + if (e.Graphics.MeasureString(secondLine, _overlayFont).Width > ellipsisLength) + { + var tempSecondLine = getCharsToMaxLength(secondLine, ellipsisLength); + + if (tempSecondLine.Contains(" ")) + { + //Another fun quirk - we only keep the parts of the second line that can be fully displayed? + //Example: + //XXXXXXXX XXXXXXXXXXX + //becomes + //XXXXXXXX... + //NOT + //XXXXXXXX X... + var lastSpaceIndex = tempSecondLine.LastIndexOf(" ", StringComparison.Ordinal); + secondLine = tempSecondLine.Substring(0, lastSpaceIndex).Trim() + "..."; + } + else + { + secondLine = tempSecondLine + "..."; + } + } + + //draw our lines, first line 16px higher than the default (?) TODO: 16 should really be passed in if new tile types ever become available + e.Graphics.DrawString(firstLine, _overlayFont, new SolidBrush(OverlayColor), + new PointF(TextOverlayPoint.X, TextOverlayPoint.Y - 16)); + e.Graphics.DrawString(secondLine, _overlayFont, new SolidBrush(OverlayColor), TextOverlayPoint); + } + else + { + //if we have no spaces, it'll always be on a single line. Check if the line needs truncating and display in default position + var renderLine = TextOverlay; + if (e.Graphics.MeasureString(renderLine, _overlayFont).Width > ellipsisLength) + renderLine = getCharsToMaxLength(renderLine, ellipsisLength) + "..."; + e.Graphics.DrawString(renderLine, _overlayFont, new SolidBrush(OverlayColor), TextOverlayPoint); + } + } + catch + { + //ignore a failure + } + } + private Image SetResolution(Image image, int width, int height) { if (image == null) return null; diff --git a/TileIconifier/Controls/PictureBox/PannablePictureBoxControlPanel.Designer.cs b/TileIconifier/Controls/PictureBox/PannablePictureBoxControlPanel.Designer.cs index 4ae7fed..d7ed289 100644 --- a/TileIconifier/Controls/PictureBox/PannablePictureBoxControlPanel.Designer.cs +++ b/TileIconifier/Controls/PictureBox/PannablePictureBoxControlPanel.Designer.cs @@ -122,7 +122,7 @@ private void InitializeComponent() // // lblPercent // - this.lblPercent.AutoSize = true; + this.lblPercent.AutoSize = false; this.lblPercent.Location = new System.Drawing.Point(36, 131); this.lblPercent.Name = "lblPercent"; this.lblPercent.Size = new System.Drawing.Size(30, 13); @@ -133,7 +133,7 @@ private void InitializeComponent() // PannablePictureBoxControlPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.lblPercent); this.Controls.Add(this.trkZoom); this.Controls.Add(this.btnCenter); diff --git a/TileIconifier/Controls/TileIconifierPanel.Designer.cs b/TileIconifier/Controls/TileIconifierPanel.Designer.cs index 8d9085f..03b7aae 100644 --- a/TileIconifier/Controls/TileIconifierPanel.Designer.cs +++ b/TileIconifier/Controls/TileIconifierPanel.Designer.cs @@ -1,4 +1,5 @@ -using TileIconifier.Controls.PictureBox; +using TileIconifier.Controls.Eyedropper; +using TileIconifier.Controls.PictureBox; namespace TileIconifier.Controls { @@ -33,11 +34,11 @@ private void InitializeComponent() this.pnlImages = new System.Windows.Forms.Panel(); this.lblSmallIcon = new System.Windows.Forms.Label(); this.lblMediumIcon = new System.Windows.Forms.Label(); - this.panPctSmallIcon = new PictureBox.PannablePictureBox(); - this.panPctMediumIcon = new PictureBox.PannablePictureBox(); + this.panPctSmallIcon = new TileIconifier.Controls.PictureBox.PannablePictureBox(); + this.panPctMediumIcon = new TileIconifier.Controls.PictureBox.PannablePictureBox(); this.chkUseSameImg = new System.Windows.Forms.CheckBox(); - this.pannablePictureBoxControlPanelMedium = new PannablePictureBoxControlPanel(); - this.pannablePictureBoxControlPanelSmall = new PannablePictureBoxControlPanel(); + this.pannablePictureBoxControlPanelMedium = new TileIconifier.Controls.PictureBox.PannablePictureBoxControlPanel(); + this.pannablePictureBoxControlPanelSmall = new TileIconifier.Controls.PictureBox.PannablePictureBoxControlPanel(); this.btnColourPicker = new System.Windows.Forms.Button(); this.btnReset = new System.Windows.Forms.Button(); this.lblUnsaved = new System.Windows.Forms.Label(); @@ -50,6 +51,7 @@ private void InitializeComponent() this.lblBGColour = new System.Windows.Forms.Label(); this.txtBGColour = new System.Windows.Forms.TextBox(); this.clrDialog = new System.Windows.Forms.ColorDialog(); + this.eyedropperColorPicker = new TileIconifier.Controls.Eyedropper.EyedropColorPicker(); this.pnlImages.SuspendLayout(); this.pnlFGColour.SuspendLayout(); this.SuspendLayout(); @@ -70,7 +72,6 @@ private void InitializeComponent() // // lblSmallIcon // - this.lblSmallIcon.AutoSize = true; this.lblSmallIcon.Location = new System.Drawing.Point(180, 2); this.lblSmallIcon.Name = "lblSmallIcon"; this.lblSmallIcon.Size = new System.Drawing.Size(58, 13); @@ -79,7 +80,6 @@ private void InitializeComponent() // // lblMediumIcon // - this.lblMediumIcon.AutoSize = true; this.lblMediumIcon.Location = new System.Drawing.Point(20, 2); this.lblMediumIcon.Name = "lblMediumIcon"; this.lblMediumIcon.Size = new System.Drawing.Size(70, 13); @@ -88,6 +88,7 @@ private void InitializeComponent() // // panPctSmallIcon // + this.panPctSmallIcon.AssociatedSize = new System.Drawing.Size(0, 0); this.panPctSmallIcon.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panPctSmallIcon.Location = new System.Drawing.Point(183, 42); this.panPctSmallIcon.Margin = new System.Windows.Forms.Padding(0); @@ -99,6 +100,7 @@ private void InitializeComponent() // // panPctMediumIcon // + this.panPctMediumIcon.AssociatedSize = new System.Drawing.Size(0, 0); this.panPctMediumIcon.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panPctMediumIcon.Location = new System.Drawing.Point(5, 17); this.panPctMediumIcon.Margin = new System.Windows.Forms.Padding(0); @@ -111,7 +113,6 @@ private void InitializeComponent() // chkUseSameImg // this.chkUseSameImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.chkUseSameImg.AutoSize = true; this.chkUseSameImg.Checked = true; this.chkUseSameImg.CheckState = System.Windows.Forms.CheckState.Checked; this.chkUseSameImg.Location = new System.Drawing.Point(7, 187); @@ -138,13 +139,13 @@ private void InitializeComponent() // // btnColourPicker // - this.btnColourPicker.BackgroundImage = global::TileIconifier.Properties.Resources.Actions_color_picker_black_icon; + this.btnColourPicker.BackgroundImage = global::TileIconifier.Properties.Resources.colorsquare; this.btnColourPicker.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btnColourPicker.FlatAppearance.BorderSize = 0; this.btnColourPicker.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnColourPicker.Location = new System.Drawing.Point(201, 270); + this.btnColourPicker.Location = new System.Drawing.Point(200, 266); this.btnColourPicker.Name = "btnColourPicker"; - this.btnColourPicker.Size = new System.Drawing.Size(23, 23); + this.btnColourPicker.Size = new System.Drawing.Size(27, 27); this.btnColourPicker.TabIndex = 39; this.btnColourPicker.UseVisualStyleBackColor = true; this.btnColourPicker.Click += new System.EventHandler(this.btnColourPicker_Click); @@ -162,7 +163,6 @@ private void InitializeComponent() // // lblUnsaved // - this.lblUnsaved.AutoSize = true; this.lblUnsaved.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblUnsaved.ForeColor = System.Drawing.Color.Red; this.lblUnsaved.Location = new System.Drawing.Point(3, 234); @@ -187,7 +187,6 @@ private void InitializeComponent() // // radFGDark // - this.radFGDark.AutoSize = true; this.radFGDark.Location = new System.Drawing.Point(58, 23); this.radFGDark.Margin = new System.Windows.Forms.Padding(2); this.radFGDark.Name = "radFGDark"; @@ -198,7 +197,6 @@ private void InitializeComponent() // // chkFGTxtEnabled // - this.chkFGTxtEnabled.AutoSize = true; this.chkFGTxtEnabled.Checked = true; this.chkFGTxtEnabled.CheckState = System.Windows.Forms.CheckState.Checked; this.chkFGTxtEnabled.Location = new System.Drawing.Point(184, 4); @@ -212,7 +210,6 @@ private void InitializeComponent() // // lblFGText // - this.lblFGText.AutoSize = true; this.lblFGText.Location = new System.Drawing.Point(1, 5); this.lblFGText.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblFGText.Name = "lblFGText"; @@ -222,7 +219,6 @@ private void InitializeComponent() // // radFGLight // - this.radFGLight.AutoSize = true; this.radFGLight.Checked = true; this.radFGLight.Location = new System.Drawing.Point(8, 23); this.radFGLight.Margin = new System.Windows.Forms.Padding(2); @@ -264,7 +260,6 @@ private void InitializeComponent() // // lblBGColour // - this.lblBGColour.AutoSize = true; this.lblBGColour.Location = new System.Drawing.Point(3, 254); this.lblBGColour.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblBGColour.Name = "lblBGColour"; @@ -283,10 +278,20 @@ private void InitializeComponent() this.txtBGColour.Text = "#323232"; this.txtBGColour.TextChanged += new System.EventHandler(this.txtBGColour_TextChanged); // + // eyedropperColorPicker + // + this.eyedropperColorPicker.Location = new System.Drawing.Point(236, 266); + this.eyedropperColorPicker.Name = "eyedropperColorPicker"; + this.eyedropperColorPicker.SelectedColor = System.Drawing.Color.Empty; + this.eyedropperColorPicker.Size = new System.Drawing.Size(30, 30); + this.eyedropperColorPicker.TabIndex = 41; + this.eyedropperColorPicker.Zoom = 4; + this.eyedropperColorPicker.SelectedColorChanged += new System.EventHandler(this.eyedropperColorPicker_SelectedColorChanged); + // // TileIconifierPanel // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.eyedropperColorPicker); this.Controls.Add(this.pnlImages); this.Controls.Add(this.btnColourPicker); this.Controls.Add(this.btnReset); @@ -299,9 +304,7 @@ private void InitializeComponent() this.Size = new System.Drawing.Size(305, 351); this.Load += new System.EventHandler(this.TileIconifierPanel_Load); this.pnlImages.ResumeLayout(false); - this.pnlImages.PerformLayout(); this.pnlFGColour.ResumeLayout(false); - this.pnlFGColour.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -329,5 +332,6 @@ private void InitializeComponent() private System.Windows.Forms.Label lblBGColour; private System.Windows.Forms.TextBox txtBGColour; private System.Windows.Forms.ColorDialog clrDialog; + private EyedropColorPicker eyedropperColorPicker; } } diff --git a/TileIconifier/Controls/TileIconifierPanel.cs b/TileIconifier/Controls/TileIconifierPanel.cs index 9c1e3c2..9fb8e53 100644 --- a/TileIconifier/Controls/TileIconifierPanel.cs +++ b/TileIconifier/Controls/TileIconifierPanel.cs @@ -34,6 +34,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; +using TileIconifier.Controls.Eyedropper; using TileIconifier.Controls.PictureBox; using TileIconifier.Core; using TileIconifier.Core.Custom; @@ -46,6 +47,7 @@ namespace TileIconifier.Controls { public partial class TileIconifierPanel : UserControl { + private readonly List _pannablePictureBoxMetaDatas = new List(); @@ -75,6 +77,8 @@ public void UpdateControlsToShortcut() //update the picture boxes to show the relevant images UpdatePictureBoxImage(panPctMediumIcon, CurrentShortcutItem.Properties.CurrentState.MediumImage); UpdatePictureBoxImage(panPctSmallIcon, CurrentShortcutItem.Properties.CurrentState.SmallImage); + UpdatePictureBoxOverlay(panPctMediumIcon, CurrentShortcutItem); + //set the associatedShortcutItemImages for each picturebox GetSenderPictureBoxToMetaData(panPctMediumIcon).ShortcutItemImage = @@ -121,6 +125,16 @@ public void UpdateControlsToShortcut() AddEventHandlers(); } + private void UpdatePictureBoxOverlay(PannablePictureBox pannablePictureBox, ShortcutItem currentShortcutItem) + { + + pannablePictureBox.ShowTextOverlay = currentShortcutItem.Properties.CurrentState.ShowNameOnSquare150X150Logo; + pannablePictureBox.OverlayColor = currentShortcutItem.Properties.CurrentState.ForegroundText == "light" + ? Color.White + : Color.Black; + pannablePictureBox.TextOverlay = Path.GetFileNameWithoutExtension(currentShortcutItem.ShortcutFileInfo.Name); + } + public void SetPictureBoxesBackColor() { var color = GetPictureBoxesBackColor(); @@ -193,7 +207,7 @@ private void IconSet(object sender) var pictureBoxMetaDataToUse = chkUseSameImg.Checked ? _pannablePictureBoxMetaDatas - : new List {GetSenderPictureBoxToMetaData(sender)}; + : new List { GetSenderPictureBoxToMetaData(sender) }; foreach (var pictureBoxMetaData in pictureBoxMetaDataToUse) { @@ -209,10 +223,10 @@ private void IconSet(object sender) private PannablePictureBoxMetaData GetSenderPictureBoxToMetaData(object sender) { PannablePictureBox senderPictureBox = null; - if (sender.GetType() == typeof (PannablePictureBoxControlPanel)) - senderPictureBox = ((PannablePictureBoxControlPanel) sender).PannablePictureBox; - if (sender.GetType() == typeof (PannablePictureBox)) - senderPictureBox = (PannablePictureBox) sender; + if (sender.GetType() == typeof(PannablePictureBoxControlPanel)) + senderPictureBox = ((PannablePictureBoxControlPanel)sender).PannablePictureBox; + if (sender.GetType() == typeof(PannablePictureBox)) + senderPictureBox = (PannablePictureBox)sender; if (senderPictureBox == null) throw new InvalidCastException($@"Sender not valid type! Received {sender.GetType()}"); @@ -233,10 +247,13 @@ private void TileIconifierPanel_Load(object sender, EventArgs e) { SetupPannablePictureBoxes(); BuildPannableShortcutBoxControlPanels(); + } private void SetupPannablePictureBoxes() { + panPctMediumIcon.TextOverlayPoint = new Point(6, 78); + _pannablePictureBoxMetaDatas.Add(new PannablePictureBoxMetaData { PannablePictureBox = panPctMediumIcon, @@ -369,7 +386,7 @@ private void panPctMediumIcon_DoubleClick(object sender, EventArgs e) private void panPctSmallIcon_Click(object sender, EventArgs e) { - if (((MouseEventArgs) e).Button != MouseButtons.Right) + if (((MouseEventArgs)e).Button != MouseButtons.Right) return; var contextMenu = new ContextMenu(); @@ -379,12 +396,12 @@ private void panPctSmallIcon_Click(object sender, EventArgs e) menuItem = new MenuItem("Center image", (o, args) => { panPctSmallIcon.CenterImage(); }); contextMenu.MenuItems.Add(menuItem); - contextMenu.Show(panPctSmallIcon, ((MouseEventArgs) e).Location); + contextMenu.Show(panPctSmallIcon, ((MouseEventArgs)e).Location); } private void panPctMediumIcon_Click(object sender, EventArgs e) { - if (((MouseEventArgs) e).Button != MouseButtons.Right) + if (((MouseEventArgs)e).Button != MouseButtons.Right) return; var contextMenu = new ContextMenu(); @@ -394,13 +411,13 @@ private void panPctMediumIcon_Click(object sender, EventArgs e) menuItem = new MenuItem("Center image", (o, args) => { panPctMediumIcon.CenterImage(); }); contextMenu.MenuItems.Add(menuItem); - contextMenu.Show(panPctMediumIcon, ((MouseEventArgs) e).Location); + contextMenu.Show(panPctMediumIcon, ((MouseEventArgs)e).Location); } private void PanPctMediumIcon_OnPannablePictureImagePropertyChange(object sender, EventArgs e) { - var item = (PannablePictureBoxImage) sender; + var item = (PannablePictureBoxImage)sender; CurrentShortcutItem.Properties.CurrentState.MediumImage.X = item.X; CurrentShortcutItem.Properties.CurrentState.MediumImage.Y = item.Y; CurrentShortcutItem.Properties.CurrentState.MediumImage.Width = item.Width; @@ -411,7 +428,7 @@ private void PanPctMediumIcon_OnPannablePictureImagePropertyChange(object sender private void PanPctSmallIcon_OnPannablePictureImagePropertyChange(object sender, EventArgs e) { - var item = (PannablePictureBoxImage) sender; + var item = (PannablePictureBoxImage)sender; CurrentShortcutItem.Properties.CurrentState.SmallImage.X = item.X; CurrentShortcutItem.Properties.CurrentState.SmallImage.Y = item.Y; CurrentShortcutItem.Properties.CurrentState.SmallImage.Width = item.Width; @@ -430,5 +447,11 @@ private void btnColourPicker_Click(object sender, EventArgs e) txtBGColour.Text = ColorUtils.ColorToHex(clrDialog.Color); } } + + private void eyedropperColorPicker_SelectedColorChanged(object sender, EventArgs e) + { + var eyedropper = (EyedropColorPicker) sender; + txtBGColour.Text = ColorUtils.ColorToHex(eyedropper.SelectedColor); + } } } \ No newline at end of file diff --git a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerAbout.Designer.cs b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerAbout.Designer.cs index 6a3b6e9..09921e1 100644 --- a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerAbout.Designer.cs +++ b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerAbout.Designer.cs @@ -46,7 +46,7 @@ private void InitializeComponent() // FrmCustomShortcutManagerHelp // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(637, 238); this.Controls.Add(this.rtxtHelp); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; diff --git a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerMain.Designer.cs b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerMain.Designer.cs index fb22272..c6ae00c 100644 --- a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerMain.Designer.cs +++ b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerMain.Designer.cs @@ -106,7 +106,7 @@ private void InitializeComponent() // FrmCustomShortcutManagerMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(623, 285); this.Controls.Add(this.btnGotoShortcut); this.Controls.Add(this.lstCustomShortcuts); diff --git a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerNew.Designer.cs b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerNew.Designer.cs index d9fd28d..b22cc7b 100644 --- a/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerNew.Designer.cs +++ b/TileIconifier/Forms/CustomShortcutForms/FrmCustomShortcutManagerNew.Designer.cs @@ -150,7 +150,7 @@ private void InitializeComponent() // // radCustomFolder // - this.radCustomFolder.AutoSize = true; + this.radCustomFolder.AutoSize = false; this.radCustomFolder.Location = new System.Drawing.Point(3, 40); this.radCustomFolder.Name = "radCustomFolder"; this.radCustomFolder.Size = new System.Drawing.Size(114, 17); @@ -160,7 +160,7 @@ private void InitializeComponent() // // radSpecialFolder // - this.radSpecialFolder.AutoSize = true; + this.radSpecialFolder.AutoSize = false; this.radSpecialFolder.Checked = true; this.radSpecialFolder.Location = new System.Drawing.Point(3, 7); this.radSpecialFolder.Name = "radSpecialFolder"; @@ -431,7 +431,7 @@ private void InitializeComponent() // // lblOtherShortcutArguments // - this.lblOtherShortcutArguments.AutoSize = true; + this.lblOtherShortcutArguments.AutoSize = false; this.lblOtherShortcutArguments.Location = new System.Drawing.Point(15, 41); this.lblOtherShortcutArguments.Name = "lblOtherShortcutArguments"; this.lblOtherShortcutArguments.Size = new System.Drawing.Size(100, 13); @@ -449,7 +449,7 @@ private void InitializeComponent() // // lblOtherTargetPath // - this.lblOtherTargetPath.AutoSize = true; + this.lblOtherTargetPath.AutoSize = false; this.lblOtherTargetPath.Location = new System.Drawing.Point(15, 15); this.lblOtherTargetPath.Name = "lblOtherTargetPath"; this.lblOtherTargetPath.Size = new System.Drawing.Size(81, 13); @@ -502,7 +502,7 @@ private void InitializeComponent() // lblShortcutName // this.lblShortcutName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblShortcutName.AutoSize = true; + this.lblShortcutName.AutoSize = false; this.lblShortcutName.Location = new System.Drawing.Point(95, 283); this.lblShortcutName.Name = "lblShortcutName"; this.lblShortcutName.Size = new System.Drawing.Size(81, 13); @@ -523,7 +523,7 @@ private void InitializeComponent() // lblCurrentIcon // this.lblCurrentIcon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblCurrentIcon.AutoSize = true; + this.lblCurrentIcon.AutoSize = false; this.lblCurrentIcon.Location = new System.Drawing.Point(12, 283); this.lblCurrentIcon.Name = "lblCurrentIcon"; this.lblCurrentIcon.Size = new System.Drawing.Size(31, 13); @@ -564,7 +564,7 @@ private void InitializeComponent() // FrmCustomShortcutManagerNew // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(652, 370); this.Controls.Add(this.radShortcutLocation); this.Controls.Add(this.txtShortcutName); diff --git a/TileIconifier/Forms/Main/FrmAbout.Designer.cs b/TileIconifier/Forms/Main/FrmAbout.Designer.cs index 8241e8a..a9386ee 100644 --- a/TileIconifier/Forms/Main/FrmAbout.Designer.cs +++ b/TileIconifier/Forms/Main/FrmAbout.Designer.cs @@ -78,8 +78,7 @@ private void InitializeComponent() // // FrmAbout // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(608, 452); this.Controls.Add(this.lblVersion); this.Controls.Add(this.lblTileIconifier); diff --git a/TileIconifier/Forms/Main/FrmAbout.resx b/TileIconifier/Forms/Main/FrmAbout.resx index aa17769..1b5ba8d 100644 --- a/TileIconifier/Forms/Main/FrmAbout.resx +++ b/TileIconifier/Forms/Main/FrmAbout.resx @@ -130,6 +130,9 @@ This uses the IconExtractor library by Tsuda Kageyu available at https://github. * IconExtractor/IconUtil for .NET * Copyright (C) 2014 Tsuda Kageyu. All rights reserved. +Eyedropper code source modified from jkristia @ http://www.codeproject.com/Articles/21965/Color-Picker-with-Color-Wheel-and-Eye-Dropper + + Current Version: [@@CURVER@@] This software is licenced as follows: diff --git a/TileIconifier/Forms/Main/FrmMain.Designer.cs b/TileIconifier/Forms/Main/FrmMain.Designer.cs index be76b8f..0e38cf8 100644 --- a/TileIconifier/Forms/Main/FrmMain.Designer.cs +++ b/TileIconifier/Forms/Main/FrmMain.Designer.cs @@ -30,6 +30,8 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.txtFilter = new System.Windows.Forms.TextBox(); + this.lblFilter = new System.Windows.Forms.Label(); this.btnDeleteCustomShortcut = new System.Windows.Forms.Button(); this.btnBuildCustomShortcut = new System.Windows.Forms.Button(); this.iconifyPanel = new TileIconifier.Controls.TileIconifierPanel(); @@ -57,6 +59,25 @@ private void InitializeComponent() this.mnuMain.SuspendLayout(); this.SuspendLayout(); // + // txtFilter + // + this.txtFilter.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.txtFilter.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; + this.txtFilter.Location = new System.Drawing.Point(50, 27); + this.txtFilter.Name = "txtFilter"; + this.txtFilter.Size = new System.Drawing.Size(455, 20); + this.txtFilter.TabIndex = 32; + this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged); + // + // lblFilter + // + this.lblFilter.AutoSize = true; + this.lblFilter.Location = new System.Drawing.Point(12, 31); + this.lblFilter.Name = "lblFilter"; + this.lblFilter.Size = new System.Drawing.Size(32, 13); + this.lblFilter.TabIndex = 31; + this.lblFilter.Text = "Filter:"; + // // btnDeleteCustomShortcut // this.btnDeleteCustomShortcut.Location = new System.Drawing.Point(12, 379); @@ -89,10 +110,10 @@ private void InitializeComponent() // this.srtlstShortcuts.FullRowSelect = true; this.srtlstShortcuts.HideSelection = false; - this.srtlstShortcuts.Location = new System.Drawing.Point(12, 23); + this.srtlstShortcuts.Location = new System.Drawing.Point(12, 53); this.srtlstShortcuts.MultiSelect = false; this.srtlstShortcuts.Name = "srtlstShortcuts"; - this.srtlstShortcuts.Size = new System.Drawing.Size(493, 240); + this.srtlstShortcuts.Size = new System.Drawing.Size(493, 210); this.srtlstShortcuts.TabIndex = 27; this.srtlstShortcuts.UseCompatibleStateImageBehavior = false; this.srtlstShortcuts.View = System.Windows.Forms.View.Details; @@ -101,7 +122,6 @@ private void InitializeComponent() // lblExePath // this.lblExePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblExePath.AutoSize = true; this.lblExePath.Location = new System.Drawing.Point(9, 309); this.lblExePath.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblExePath.Name = "lblExePath"; @@ -147,7 +167,6 @@ private void InitializeComponent() // lblLnkPath // this.lblLnkPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLnkPath.AutoSize = true; this.lblLnkPath.Location = new System.Drawing.Point(9, 269); this.lblLnkPath.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblLnkPath.Name = "lblLnkPath"; @@ -281,9 +300,10 @@ private void InitializeComponent() // // FrmMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(827, 407); + this.Controls.Add(this.txtFilter); + this.Controls.Add(this.lblFilter); this.Controls.Add(this.btnDeleteCustomShortcut); this.Controls.Add(this.btnBuildCustomShortcut); this.Controls.Add(this.iconifyPanel); @@ -334,6 +354,8 @@ private void InitializeComponent() private TileIconifierPanel iconifyPanel; private System.Windows.Forms.Button btnBuildCustomShortcut; private System.Windows.Forms.Button btnDeleteCustomShortcut; + private System.Windows.Forms.Label lblFilter; + private System.Windows.Forms.TextBox txtFilter; } } diff --git a/TileIconifier/Forms/Main/FrmMain.cs b/TileIconifier/Forms/Main/FrmMain.cs index 028c5d9..2480d51 100644 --- a/TileIconifier/Forms/Main/FrmMain.cs +++ b/TileIconifier/Forms/Main/FrmMain.cs @@ -29,14 +29,11 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.Threading; using System.Windows.Forms; using TileIconifier.Controls.Shortcut; using TileIconifier.Core.Custom; using TileIconifier.Core.Shortcut; -using TileIconifier.Core.Utilities; using TileIconifier.Forms.CustomShortcutForms; using TileIconifier.Utilities; @@ -46,6 +43,7 @@ public partial class FrmMain : SkinnableForm { private ShortcutItemListViewItem _currentShortcutListViewItem; private List _shortcutsList; + private List _filteredList; public FrmMain() { @@ -67,6 +65,7 @@ private void frmDropper_Load(object sender, EventArgs e) iconifyPanel.OnIconifyPanelUpdate += (s, ev) => { UpdateFormControls(); }; CheckForUpdates(true); + InitializeListboxColumns(); Show(); StartFullUpdate(); @@ -234,5 +233,12 @@ private void btnDeleteCustomShortcut_Click(object sender, EventArgs e) StartFullUpdate(); } + + private void txtFilter_TextChanged(object sender, EventArgs e) + { + UpdateFilteredList(); + BuildShortcutList(); + UpdateShortcut(); + } } } \ No newline at end of file diff --git a/TileIconifier/Forms/Main/FrmMainMethods.cs b/TileIconifier/Forms/Main/FrmMainMethods.cs index a4243e4..93a22e6 100644 --- a/TileIconifier/Forms/Main/FrmMainMethods.cs +++ b/TileIconifier/Forms/Main/FrmMainMethods.cs @@ -31,7 +31,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows.Forms; using TileIconifier.Controls.Shortcut; using TileIconifier.Core.Shortcut; @@ -74,6 +73,8 @@ private void FullUpdate(object sender, DoWorkEventArgs e) _shortcutsList = ShortcutItemEnumeration.GetShortcuts(true) .Select(s => new ShortcutItemListViewItem(s)) .ToList(); + + UpdateFilteredList(); } if (srtlstShortcuts.InvokeRequired) @@ -85,16 +86,11 @@ private void FullUpdate(object sender, DoWorkEventArgs e) private void BuildShortcutList() { srtlstShortcuts.Items.Clear(); - srtlstShortcuts.Columns.Clear(); - srtlstShortcuts.Columns.Add("Shortcut Name", srtlstShortcuts.Width/7*4 - 10, HorizontalAlignment.Left); - srtlstShortcuts.Columns.Add("Is Custom?", srtlstShortcuts.Width/7 - 2, HorizontalAlignment.Left); - srtlstShortcuts.Columns.Add("Is Iconified?", srtlstShortcuts.Width/7 - 2, HorizontalAlignment.Left); - srtlstShortcuts.Columns.Add("Is Pinned?", srtlstShortcuts.Width/7 - 4, HorizontalAlignment.Left); var smallImageList = new ImageList(); - for (var i = 0; i < _shortcutsList.Count; i++) + for (var i = 0; i < _filteredList.Count; i++) { - var shortcutItem = _shortcutsList[i]; + var shortcutItem = _filteredList[i]; srtlstShortcuts.Items.Add(shortcutItem); smallImageList.Images.Add(shortcutItem.ShortcutItem.StandardIcon ?? Resources.QuestionMark); @@ -156,10 +152,13 @@ private void UpdateFormControls() //update the column view _currentShortcutListViewItem.UpdateColumns(); var currentShortcutIndex = srtlstShortcuts.Items.IndexOf(_currentShortcutListViewItem); - srtlstShortcuts.RedrawItems( - currentShortcutIndex, - currentShortcutIndex, - false); + if (currentShortcutIndex >= 0) + { + srtlstShortcuts.RedrawItems( + currentShortcutIndex, + currentShortcutIndex, + false); + } } private void UpdateShortcut() @@ -171,6 +170,7 @@ private void UpdateShortcut() private void JumpToShortcutItem(ShortcutItem shortcutItem) { + UpdateFilteredList(true); var shortcutListViewItem = _shortcutsList.First( s => s.ShortcutItem.ShortcutFileInfo.FullName == shortcutItem.ShortcutFileInfo.FullName); @@ -226,5 +226,20 @@ private async void CheckForUpdates(bool silentIfNoUpdateDetected) } } } + + private void UpdateFilteredList(bool resetTextBox = false) + { + if (resetTextBox) + txtFilter.Text = string.Empty; + _filteredList = _shortcutsList.Where(s => s.Text.ToUpper().Contains(txtFilter.Text.ToUpper())).ToList(); + } + + private void InitializeListboxColumns() + { + srtlstShortcuts.Columns.Add("Shortcut Name", srtlstShortcuts.Width/7*4 - 10, HorizontalAlignment.Left); + srtlstShortcuts.Columns.Add("Is Custom?", srtlstShortcuts.Width/7 - 2, HorizontalAlignment.Left); + srtlstShortcuts.Columns.Add("Is Iconified?", srtlstShortcuts.Width/7 - 2, HorizontalAlignment.Left); + srtlstShortcuts.Columns.Add("Is Pinned?", srtlstShortcuts.Width/7 - 4, HorizontalAlignment.Left); + } } } \ No newline at end of file diff --git a/TileIconifier/Forms/Main/frmHelp.Designer.cs b/TileIconifier/Forms/Main/frmHelp.Designer.cs index 23e7fab..9979f37 100644 --- a/TileIconifier/Forms/Main/frmHelp.Designer.cs +++ b/TileIconifier/Forms/Main/frmHelp.Designer.cs @@ -46,7 +46,7 @@ private void InitializeComponent() // FrmHelp // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(660, 327); this.Controls.Add(this.rtxtAbout); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; diff --git a/TileIconifier/Forms/Shared/FrmException.Designer.cs b/TileIconifier/Forms/Shared/FrmException.Designer.cs index 0e243bc..b3825ec 100644 --- a/TileIconifier/Forms/Shared/FrmException.Designer.cs +++ b/TileIconifier/Forms/Shared/FrmException.Designer.cs @@ -47,7 +47,7 @@ private void InitializeComponent() // FrmException // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(614, 452); this.Controls.Add(this.rtxtUnhandledException); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; diff --git a/TileIconifier/Forms/Shared/FrmIconSelector.Designer.cs b/TileIconifier/Forms/Shared/FrmIconSelector.Designer.cs index 30289a9..670471f 100644 --- a/TileIconifier/Forms/Shared/FrmIconSelector.Designer.cs +++ b/TileIconifier/Forms/Shared/FrmIconSelector.Designer.cs @@ -56,7 +56,7 @@ private void InitializeComponent() // lblPreview // this.lblPreview.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.lblPreview.AutoSize = true; + this.lblPreview.AutoSize = false; this.lblPreview.Location = new System.Drawing.Point(13, 327); this.lblPreview.Name = "lblPreview"; this.lblPreview.Size = new System.Drawing.Size(45, 13); @@ -76,7 +76,7 @@ private void InitializeComponent() // lblCommonDlls // this.lblCommonDlls.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.lblCommonDlls.AutoSize = true; + this.lblCommonDlls.AutoSize = false; this.lblCommonDlls.Location = new System.Drawing.Point(10, 56); this.lblCommonDlls.Name = "lblCommonDlls"; this.lblCommonDlls.Size = new System.Drawing.Size(100, 13); @@ -150,7 +150,7 @@ private void InitializeComponent() // label1 // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.label1.AutoSize = true; + this.label1.AutoSize = false; this.label1.Location = new System.Drawing.Point(13, 304); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(60, 13); @@ -169,7 +169,7 @@ private void InitializeComponent() // radUseCustomImage // this.radUseCustomImage.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.radUseCustomImage.AutoSize = true; + this.radUseCustomImage.AutoSize = false; this.radUseCustomImage.Location = new System.Drawing.Point(14, 281); this.radUseCustomImage.Name = "radUseCustomImage"; this.radUseCustomImage.Size = new System.Drawing.Size(112, 17); @@ -181,7 +181,7 @@ private void InitializeComponent() // radIconFromTarget // this.radIconFromTarget.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.radIconFromTarget.AutoSize = true; + this.radIconFromTarget.AutoSize = false; this.radIconFromTarget.Checked = true; this.radIconFromTarget.Location = new System.Drawing.Point(11, 21); this.radIconFromTarget.Name = "radIconFromTarget"; @@ -215,7 +215,7 @@ private void InitializeComponent() // FrmIconSelector // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(578, 401); this.Controls.Add(this.lblPreview); this.Controls.Add(this.pctPreview); diff --git a/TileIconifier/Forms/Shared/FrmLoadingSplash.Designer.cs b/TileIconifier/Forms/Shared/FrmLoadingSplash.Designer.cs index a1c0eb3..6a74bb1 100644 --- a/TileIconifier/Forms/Shared/FrmLoadingSplash.Designer.cs +++ b/TileIconifier/Forms/Shared/FrmLoadingSplash.Designer.cs @@ -55,7 +55,7 @@ private void InitializeComponent() // FrmLoadingSplash // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(259, 44); this.ControlBox = false; this.Controls.Add(this.lblLoading); diff --git a/TileIconifier/Properties/Resources.Designer.cs b/TileIconifier/Properties/Resources.Designer.cs index c34dfee..464f62e 100644 --- a/TileIconifier/Properties/Resources.Designer.cs +++ b/TileIconifier/Properties/Resources.Designer.cs @@ -70,6 +70,16 @@ internal static System.Drawing.Bitmap Actions_color_picker_black_icon { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap colorsquare { + get { + object obj = ResourceManager.GetObject("colorsquare", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to '-------------------------------------------------------------------------------- ///'--- AUTOGENERATED BY TILEICONIFIER - DO NOT MANUALLY EDIT --- diff --git a/TileIconifier/Properties/Resources.resx b/TileIconifier/Properties/Resources.resx index 798a432..a143774 100644 --- a/TileIconifier/Properties/Resources.resx +++ b/TileIconifier/Properties/Resources.resx @@ -168,4 +168,7 @@ WshShell.Run targetPath & " " & targetArguments, {5} ..\Resources\Zoom_5442.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\colorsquare.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/TileIconifier/Resources/colorsquare.png b/TileIconifier/Resources/colorsquare.png new file mode 100644 index 0000000..dfcd06d Binary files /dev/null and b/TileIconifier/Resources/colorsquare.png differ diff --git a/TileIconifier/TileIconifier.WinForms.csproj b/TileIconifier/TileIconifier.WinForms.csproj index 0fdcac1..c8bf128 100644 --- a/TileIconifier/TileIconifier.WinForms.csproj +++ b/TileIconifier/TileIconifier.WinForms.csproj @@ -109,6 +109,9 @@ AllOrCurrentUserRadios.cs + + Component + UserControl @@ -129,6 +132,7 @@ + @@ -314,6 +318,7 @@ + diff --git a/TileIconifier/app.manifest b/TileIconifier/app.manifest index c78db92..b717d28 100644 --- a/TileIconifier/app.manifest +++ b/TileIconifier/app.manifest @@ -50,11 +50,11 @@ to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. --> - +