├── .gitignore ├── LICENSE ├── README.md ├── WinScroll.sln ├── WinScroll ├── App.config ├── Macro.cs ├── NativeMethods.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── WinScroll.Designer.cs ├── WinScroll.cs ├── WinScroll.csproj ├── WinScroll.resx └── winscroll.ico └── winscroll.ico /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | [Rr]eleases/ 14 | x64/ 15 | x86/ 16 | build/ 17 | bld/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # Roslyn cache directories 22 | *.ide/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | #NUNIT 29 | *.VisualState.xml 30 | TestResult.xml 31 | 32 | # Build Results of an ATL Project 33 | [Dd]ebugPS/ 34 | [Rr]eleasePS/ 35 | dlldata.c 36 | 37 | *_i.c 38 | *_p.c 39 | *_i.h 40 | *.ilk 41 | *.meta 42 | *.obj 43 | *.pch 44 | *.pdb 45 | *.pgc 46 | *.pgd 47 | *.rsp 48 | *.sbr 49 | *.tlb 50 | *.tli 51 | *.tlh 52 | *.tmp 53 | *.tmp_proj 54 | *.log 55 | *.vspscc 56 | *.vssscc 57 | .builds 58 | *.pidb 59 | *.svclog 60 | *.scc 61 | 62 | # Chutzpah Test files 63 | _Chutzpah* 64 | 65 | # Visual C++ cache files 66 | ipch/ 67 | *.aps 68 | *.ncb 69 | *.opensdf 70 | *.sdf 71 | *.cachefile 72 | 73 | # Visual Studio profiler 74 | *.psess 75 | *.vsp 76 | *.vspx 77 | 78 | # TFS 2012 Local Workspace 79 | $tf/ 80 | 81 | # Guidance Automation Toolkit 82 | *.gpState 83 | 84 | # ReSharper is a .NET coding add-in 85 | _ReSharper*/ 86 | *.[Rr]e[Ss]harper 87 | *.DotSettings.user 88 | 89 | # JustCode is a .NET coding addin-in 90 | .JustCode 91 | 92 | # TeamCity is a build add-in 93 | _TeamCity* 94 | 95 | # DotCover is a Code Coverage Tool 96 | *.dotCover 97 | 98 | # NCrunch 99 | _NCrunch_* 100 | .*crunch*.local.xml 101 | 102 | # MightyMoose 103 | *.mm.* 104 | AutoTest.Net/ 105 | 106 | # Web workbench (sass) 107 | .sass-cache/ 108 | 109 | # Installshield output folder 110 | [Ee]xpress/ 111 | 112 | # DocProject is a documentation generator add-in 113 | DocProject/buildhelp/ 114 | DocProject/Help/*.HxT 115 | DocProject/Help/*.HxC 116 | DocProject/Help/*.hhc 117 | DocProject/Help/*.hhk 118 | DocProject/Help/*.hhp 119 | DocProject/Help/Html2 120 | DocProject/Help/html 121 | 122 | # Click-Once directory 123 | publish/ 124 | 125 | # Publish Web Output 126 | *.[Pp]ublish.xml 127 | *.azurePubxml 128 | # TODO: Comment the next line if you want to checkin your web deploy settings 129 | # but database connection strings (with potential passwords) will be unencrypted 130 | *.pubxml 131 | 132 | # NuGet Packages 133 | *.nupkg 134 | # The packages folder can be ignored because of Package Restore 135 | **/packages/* 136 | # except build/, which is used as an MSBuild target. 137 | !**/packages/build/ 138 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 139 | #!**/packages/repositories.config 140 | 141 | # Windows Azure Build Output 142 | csx/ 143 | *.build.csdef 144 | 145 | # Windows Store app package directory 146 | AppPackages/ 147 | 148 | # Others 149 | sql/ 150 | *.Cache 151 | ClientBin/ 152 | [Ss]tyle[Cc]op.* 153 | ~$* 154 | *~ 155 | *.dbmdl 156 | *.dbproj.schemaview 157 | *.pfx 158 | *.publishsettings 159 | node_modules/ 160 | 161 | # RIA/Silverlight projects 162 | Generated_Code/ 163 | 164 | # Backup & report files from converting an old project file 165 | # to a newer Visual Studio version. Backup files are not needed, 166 | # because we have git ;-) 167 | _UpgradeReport_Files/ 168 | Backup*/ 169 | UpgradeLog*.XML 170 | UpgradeLog*.htm 171 | 172 | # SQL Server files 173 | *.mdf 174 | *.ldf 175 | 176 | # Business Intelligence projects 177 | *.rdl.data 178 | *.bim.layout 179 | *.bim_*.settings 180 | 181 | # Microsoft Fakes 182 | FakesAssemblies/ 183 | 184 | # OS junk files 185 | [Tt]humbs.db 186 | *.DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WinScroll 2 | A cursor capture and window snapping utility for Windows. 3 | 4 | ![Winscroll](http://i.imgur.com/CezAw3t.png) 5 | -------------------------------------------------------------------------------- /WinScroll.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinScroll", "WinScroll\WinScroll.csproj", "{3FAA0F95-F4F3-4820-B889-5C5864DD3A37}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B1C091A9-147E-4A23-860A-89B658F3536B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3FAA0F95-F4F3-4820-B889-5C5864DD3A37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {3FAA0F95-F4F3-4820-B889-5C5864DD3A37}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {3FAA0F95-F4F3-4820-B889-5C5864DD3A37}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {3FAA0F95-F4F3-4820-B889-5C5864DD3A37}.Release|Any CPU.Build.0 = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /WinScroll/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 0 20 | 21 | 22 | 0 23 | 24 | 25 | 800 26 | 27 | 28 | 600 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /WinScroll/Macro.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | using System.Runtime.InteropServices; 9 | using Microsoft.Win32; 10 | 11 | namespace WinScroll 12 | { 13 | public static class Macro 14 | { 15 | //Registers a hot key with Windows. 16 | [DllImport("user32.dll")] 17 | private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk); 18 | //Unregisters the hot key with Windows. 19 | [DllImport("user32.dll")] 20 | private static extern bool UnregisterHotKey(IntPtr hWnd, int keyId); 21 | 22 | public static int WM_HOTKEY = 0x0312; 23 | #region fields 24 | public static int MOD_ALT = 0x1; 25 | public static int MOD_CONTROL = 0x2; 26 | public static int MOD_SHIFT = 0x4; 27 | public static int MOD_WIN = 0x8; 28 | 29 | #endregion 30 | public static void RegisterHotKey(Form f, Keys key, int id) 31 | { 32 | int modifiers = 0; 33 | 34 | if((key & Keys.Alt) == Keys.Alt) 35 | modifiers = modifiers | MOD_ALT; 36 | 37 | if((key & Keys.Control) == Keys.Control) 38 | modifiers = modifiers | MOD_CONTROL; 39 | 40 | if((key & Keys.Shift) == Keys.Shift) 41 | modifiers = modifiers | MOD_SHIFT; 42 | 43 | Keys k = key & ~Keys.Control & ~Keys.Shift & ~Keys.Alt; 44 | RegisterHotKey((IntPtr)f.Handle, id, (uint)modifiers, (uint)k); 45 | } 46 | 47 | public static void UnregisterHotKey(Form f, int id) 48 | { 49 | try 50 | { 51 | UnregisterHotKey(f.Handle, id); // modify this if you want more than one hotkey 52 | } 53 | catch(Exception ex) 54 | { 55 | MessageBox.Show(ex.ToString()); 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /WinScroll/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Drawing; 6 | using System.Threading.Tasks; 7 | using System.Runtime.InteropServices; 8 | using Microsoft.Win32; 9 | 10 | namespace WinScroll 11 | { 12 | public struct Rect 13 | { 14 | public int Left; 15 | public int Top; 16 | public int Right; 17 | public int Bottom; 18 | 19 | public Rect(int l, int t, int r, int b) 20 | { 21 | Left = l; 22 | Top = t; 23 | Right = r; 24 | Bottom = b; 25 | } 26 | 27 | public override string ToString() 28 | { 29 | return Left.ToString() + ", " + Top.ToString() + " : " + Right.ToString() + ", " + Bottom.ToString(); 30 | } 31 | } 32 | 33 | public static class NativeMethods 34 | { 35 | public const int HWND_BROADCAST = 0xffff; 36 | public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME"); 37 | 38 | [DllImport("user32")] 39 | public static extern bool PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); 40 | [DllImport("user32.dll")] 41 | public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); 42 | [DllImport("user32")] 43 | public static extern int RegisterWindowMessage(string message); 44 | 45 | [DllImport("user32.dll")] 46 | [return: MarshalAs(UnmanagedType.Bool)] 47 | public static extern bool GetCursorPos(out Point lpPoint); 48 | [DllImport("user32.dll")] 49 | public static extern bool SetCursorPos(int X, int Y); 50 | 51 | [DllImport("user32.dll")] 52 | public static extern bool ClipCursor(ref Rectangle lpRect); 53 | [DllImport("user32.dll")] 54 | public static extern void ClipCursor(IntPtr rect); 55 | 56 | [DllImport("user32.dll")] 57 | public static extern IntPtr GetActiveWindow(); 58 | [DllImport("user32.dll")] 59 | public static extern IntPtr GetForegroundWindow(); 60 | 61 | [DllImport("user32.dll", SetLastError = true)] 62 | internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); 63 | 64 | [DllImport("user32.dll")] 65 | public static extern bool GetWindowRect(IntPtr hwnd, ref Rect rectangle); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /WinScroll/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Windows.Forms; 6 | 7 | namespace WinScroll 8 | { 9 | static class Program 10 | { 11 | static Mutex mutex = new Mutex(true, "{WinScroll-Pete-Goodfellow}"); 12 | 13 | /// 14 | /// The main entry point for the application. 15 | /// 16 | [STAThread] 17 | static void Main() 18 | { 19 | if(mutex.WaitOne(TimeSpan.Zero, true)) 20 | { 21 | Application.EnableVisualStyles(); 22 | Application.SetCompatibleTextRenderingDefault(false); 23 | Application.Run(new WinScroll()); 24 | mutex.ReleaseMutex(); 25 | } 26 | else 27 | { 28 | NativeMethods.SendMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /WinScroll/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("WinScroll")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("WinScroll")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f4a685e4-2824-4ac4-9745-4839ea7be7b6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WinScroll/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinScroll.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinScroll.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /WinScroll/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /WinScroll/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinScroll.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 29 | public decimal CaptureX { 30 | get { 31 | return ((decimal)(this["CaptureX"])); 32 | } 33 | set { 34 | this["CaptureX"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 41 | public decimal CaptureY { 42 | get { 43 | return ((decimal)(this["CaptureY"])); 44 | } 45 | set { 46 | this["CaptureY"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("800")] 53 | public decimal CaptureWidth { 54 | get { 55 | return ((decimal)(this["CaptureWidth"])); 56 | } 57 | set { 58 | this["CaptureWidth"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("600")] 65 | public decimal CaptureHeight { 66 | get { 67 | return ((decimal)(this["CaptureHeight"])); 68 | } 69 | set { 70 | this["CaptureHeight"] = value; 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /WinScroll/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 0 7 | 8 | 9 | 0 10 | 11 | 12 | 800 13 | 14 | 15 | 600 16 | 17 | 18 | -------------------------------------------------------------------------------- /WinScroll/WinScroll.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WinScroll 2 | { 3 | partial class WinScroll 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if(disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinScroll)); 33 | this.options = new System.Windows.Forms.GroupBox(); 34 | this.windowCheck = new System.Windows.Forms.CheckBox(); 35 | this.startupCheck = new System.Windows.Forms.CheckBox(); 36 | this.trayCheck = new System.Windows.Forms.CheckBox(); 37 | this.captureCheck = new System.Windows.Forms.CheckBox(); 38 | this.credit = new System.Windows.Forms.GroupBox(); 39 | this.aboutLink = new System.Windows.Forms.LinkLabel(); 40 | this.tooltip = new System.Windows.Forms.ToolTip(this.components); 41 | this.cursor = new System.Windows.Forms.GroupBox(); 42 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 43 | this.labelCoords = new System.Windows.Forms.Label(); 44 | this.captureHeight = new System.Windows.Forms.NumericUpDown(); 45 | this.label4 = new System.Windows.Forms.Label(); 46 | this.captureWidth = new System.Windows.Forms.NumericUpDown(); 47 | this.label3 = new System.Windows.Forms.Label(); 48 | this.label2 = new System.Windows.Forms.Label(); 49 | this.label1 = new System.Windows.Forms.Label(); 50 | this.captureY = new System.Windows.Forms.NumericUpDown(); 51 | this.captureX = new System.Windows.Forms.NumericUpDown(); 52 | this.window = new System.Windows.Forms.GroupBox(); 53 | this.colsNum = new System.Windows.Forms.NumericUpDown(); 54 | this.rowsNum = new System.Windows.Forms.NumericUpDown(); 55 | this.label7 = new System.Windows.Forms.Label(); 56 | this.label8 = new System.Windows.Forms.Label(); 57 | this.columns = new System.Windows.Forms.NumericUpDown(); 58 | this.rows = new System.Windows.Forms.NumericUpDown(); 59 | this.label6 = new System.Windows.Forms.Label(); 60 | this.label5 = new System.Windows.Forms.Label(); 61 | this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); 62 | this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 63 | this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 64 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 65 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 66 | this.label9 = new System.Windows.Forms.Label(); 67 | this.label10 = new System.Windows.Forms.Label(); 68 | this.options.SuspendLayout(); 69 | this.credit.SuspendLayout(); 70 | this.cursor.SuspendLayout(); 71 | this.tableLayoutPanel.SuspendLayout(); 72 | ((System.ComponentModel.ISupportInitialize)(this.captureHeight)).BeginInit(); 73 | ((System.ComponentModel.ISupportInitialize)(this.captureWidth)).BeginInit(); 74 | ((System.ComponentModel.ISupportInitialize)(this.captureY)).BeginInit(); 75 | ((System.ComponentModel.ISupportInitialize)(this.captureX)).BeginInit(); 76 | this.window.SuspendLayout(); 77 | ((System.ComponentModel.ISupportInitialize)(this.colsNum)).BeginInit(); 78 | ((System.ComponentModel.ISupportInitialize)(this.rowsNum)).BeginInit(); 79 | ((System.ComponentModel.ISupportInitialize)(this.columns)).BeginInit(); 80 | ((System.ComponentModel.ISupportInitialize)(this.rows)).BeginInit(); 81 | this.contextMenuStrip.SuspendLayout(); 82 | this.SuspendLayout(); 83 | // 84 | // options 85 | // 86 | this.options.Controls.Add(this.windowCheck); 87 | this.options.Controls.Add(this.startupCheck); 88 | this.options.Controls.Add(this.trayCheck); 89 | this.options.Controls.Add(this.captureCheck); 90 | this.options.Location = new System.Drawing.Point(12, 12); 91 | this.options.Name = "options"; 92 | this.options.Size = new System.Drawing.Size(128, 112); 93 | this.options.TabIndex = 0; 94 | this.options.TabStop = false; 95 | this.options.Text = "Options"; 96 | // 97 | // windowCheck 98 | // 99 | this.windowCheck.AutoSize = true; 100 | this.windowCheck.Location = new System.Drawing.Point(6, 88); 101 | this.windowCheck.Name = "windowCheck"; 102 | this.windowCheck.Size = new System.Drawing.Size(105, 17); 103 | this.windowCheck.TabIndex = 3; 104 | this.windowCheck.Text = "Enable snapping"; 105 | this.tooltip.SetToolTip(this.windowCheck, "Enable window snapping hotkeys."); 106 | this.windowCheck.UseVisualStyleBackColor = true; 107 | // 108 | // startupCheck 109 | // 110 | this.startupCheck.AutoSize = true; 111 | this.startupCheck.Location = new System.Drawing.Point(6, 42); 112 | this.startupCheck.Name = "startupCheck"; 113 | this.startupCheck.Size = new System.Drawing.Size(96, 17); 114 | this.startupCheck.TabIndex = 1; 115 | this.startupCheck.Text = "Run on startup"; 116 | this.tooltip.SetToolTip(this.startupCheck, "Start WinScroll automatically on startup."); 117 | this.startupCheck.UseVisualStyleBackColor = true; 118 | // 119 | // trayCheck 120 | // 121 | this.trayCheck.AutoSize = true; 122 | this.trayCheck.Location = new System.Drawing.Point(6, 19); 123 | this.trayCheck.Name = "trayCheck"; 124 | this.trayCheck.Size = new System.Drawing.Size(91, 17); 125 | this.trayCheck.TabIndex = 0; 126 | this.trayCheck.Text = "Hide tray icon"; 127 | this.tooltip.SetToolTip(this.trayCheck, "Hide the icon in the tray area."); 128 | this.trayCheck.UseVisualStyleBackColor = true; 129 | // 130 | // captureCheck 131 | // 132 | this.captureCheck.AutoSize = true; 133 | this.captureCheck.Location = new System.Drawing.Point(6, 65); 134 | this.captureCheck.Name = "captureCheck"; 135 | this.captureCheck.Size = new System.Drawing.Size(98, 17); 136 | this.captureCheck.TabIndex = 2; 137 | this.captureCheck.Text = "Enable capture"; 138 | this.tooltip.SetToolTip(this.captureCheck, "Prevent the cursor from leaving the specified area."); 139 | this.captureCheck.UseVisualStyleBackColor = true; 140 | // 141 | // credit 142 | // 143 | this.credit.Controls.Add(this.aboutLink); 144 | this.credit.Location = new System.Drawing.Point(12, 130); 145 | this.credit.Name = "credit"; 146 | this.credit.Size = new System.Drawing.Size(128, 40); 147 | this.credit.TabIndex = 1; 148 | this.credit.TabStop = false; 149 | this.credit.Text = "WinScroll 0.5"; 150 | // 151 | // aboutLink 152 | // 153 | this.aboutLink.AutoSize = true; 154 | this.aboutLink.LinkArea = new System.Windows.Forms.LinkArea(3, 18); 155 | this.aboutLink.LinkColor = System.Drawing.Color.Blue; 156 | this.aboutLink.Location = new System.Drawing.Point(6, 16); 157 | this.aboutLink.Name = "aboutLink"; 158 | this.aboutLink.Size = new System.Drawing.Size(102, 17); 159 | this.aboutLink.TabIndex = 1; 160 | this.aboutLink.TabStop = true; 161 | this.aboutLink.Text = "by Pete Goodfellow"; 162 | this.tooltip.SetToolTip(this.aboutLink, "Visit the Github project page!"); 163 | this.aboutLink.UseCompatibleTextRendering = true; 164 | this.aboutLink.VisitedLinkColor = System.Drawing.Color.Blue; 165 | // 166 | // cursor 167 | // 168 | this.cursor.Controls.Add(this.tableLayoutPanel); 169 | this.cursor.Controls.Add(this.captureHeight); 170 | this.cursor.Controls.Add(this.label4); 171 | this.cursor.Controls.Add(this.captureWidth); 172 | this.cursor.Controls.Add(this.label3); 173 | this.cursor.Controls.Add(this.label2); 174 | this.cursor.Controls.Add(this.label1); 175 | this.cursor.Controls.Add(this.captureY); 176 | this.cursor.Controls.Add(this.captureX); 177 | this.cursor.Location = new System.Drawing.Point(146, 12); 178 | this.cursor.Name = "cursor"; 179 | this.cursor.Size = new System.Drawing.Size(226, 73); 180 | this.cursor.TabIndex = 2; 181 | this.cursor.TabStop = false; 182 | this.cursor.Text = "Cursor Capture"; 183 | // 184 | // tableLayoutPanel 185 | // 186 | this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 187 | this.tableLayoutPanel.AutoSize = true; 188 | this.tableLayoutPanel.ColumnCount = 1; 189 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 190 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 191 | this.tableLayoutPanel.Controls.Add(this.labelCoords, 0, 0); 192 | this.tableLayoutPanel.Location = new System.Drawing.Point(170, 0); 193 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 194 | this.tableLayoutPanel.RowCount = 1; 195 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 196 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 197 | this.tableLayoutPanel.Size = new System.Drawing.Size(50, 13); 198 | this.tableLayoutPanel.TabIndex = 1; 199 | // 200 | // labelCoords 201 | // 202 | this.labelCoords.AutoSize = true; 203 | this.labelCoords.Dock = System.Windows.Forms.DockStyle.Right; 204 | this.labelCoords.Location = new System.Drawing.Point(8, 0); 205 | this.labelCoords.Name = "labelCoords"; 206 | this.labelCoords.Size = new System.Drawing.Size(39, 13); 207 | this.labelCoords.TabIndex = 9; 208 | this.labelCoords.Text = "coords"; 209 | // 210 | // captureHeight 211 | // 212 | this.captureHeight.Location = new System.Drawing.Point(150, 46); 213 | this.captureHeight.Maximum = new decimal(new int[] { 214 | 10000, 215 | 0, 216 | 0, 217 | 0}); 218 | this.captureHeight.Minimum = new decimal(new int[] { 219 | 10000, 220 | 0, 221 | 0, 222 | -2147483648}); 223 | this.captureHeight.Name = "captureHeight"; 224 | this.captureHeight.Size = new System.Drawing.Size(70, 20); 225 | this.captureHeight.TabIndex = 8; 226 | this.captureHeight.Value = new decimal(new int[] { 227 | 600, 228 | 0, 229 | 0, 230 | 0}); 231 | // 232 | // label4 233 | // 234 | this.label4.AutoSize = true; 235 | this.label4.Location = new System.Drawing.Point(109, 48); 236 | this.label4.Name = "label4"; 237 | this.label4.Size = new System.Drawing.Size(38, 13); 238 | this.label4.TabIndex = 7; 239 | this.label4.Text = "Height"; 240 | // 241 | // captureWidth 242 | // 243 | this.captureWidth.Location = new System.Drawing.Point(150, 19); 244 | this.captureWidth.Maximum = new decimal(new int[] { 245 | 10000, 246 | 0, 247 | 0, 248 | 0}); 249 | this.captureWidth.Minimum = new decimal(new int[] { 250 | 10000, 251 | 0, 252 | 0, 253 | -2147483648}); 254 | this.captureWidth.Name = "captureWidth"; 255 | this.captureWidth.Size = new System.Drawing.Size(70, 20); 256 | this.captureWidth.TabIndex = 6; 257 | this.captureWidth.Value = new decimal(new int[] { 258 | 800, 259 | 0, 260 | 0, 261 | 0}); 262 | // 263 | // label3 264 | // 265 | this.label3.AutoSize = true; 266 | this.label3.Location = new System.Drawing.Point(109, 22); 267 | this.label3.Name = "label3"; 268 | this.label3.Size = new System.Drawing.Size(35, 13); 269 | this.label3.TabIndex = 5; 270 | this.label3.Text = "Width"; 271 | // 272 | // label2 273 | // 274 | this.label2.AutoSize = true; 275 | this.label2.Location = new System.Drawing.Point(6, 48); 276 | this.label2.Name = "label2"; 277 | this.label2.Size = new System.Drawing.Size(14, 13); 278 | this.label2.TabIndex = 4; 279 | this.label2.Text = "Y"; 280 | // 281 | // label1 282 | // 283 | this.label1.AutoSize = true; 284 | this.label1.Location = new System.Drawing.Point(6, 22); 285 | this.label1.Name = "label1"; 286 | this.label1.Size = new System.Drawing.Size(14, 13); 287 | this.label1.TabIndex = 3; 288 | this.label1.Text = "X"; 289 | // 290 | // captureY 291 | // 292 | this.captureY.Location = new System.Drawing.Point(26, 46); 293 | this.captureY.Maximum = new decimal(new int[] { 294 | 10000, 295 | 0, 296 | 0, 297 | 0}); 298 | this.captureY.Minimum = new decimal(new int[] { 299 | 10000, 300 | 0, 301 | 0, 302 | -2147483648}); 303 | this.captureY.Name = "captureY"; 304 | this.captureY.Size = new System.Drawing.Size(70, 20); 305 | this.captureY.TabIndex = 2; 306 | // 307 | // captureX 308 | // 309 | this.captureX.Location = new System.Drawing.Point(26, 19); 310 | this.captureX.Maximum = new decimal(new int[] { 311 | 10000, 312 | 0, 313 | 0, 314 | 0}); 315 | this.captureX.Minimum = new decimal(new int[] { 316 | 10000, 317 | 0, 318 | 0, 319 | -2147483648}); 320 | this.captureX.Name = "captureX"; 321 | this.captureX.Size = new System.Drawing.Size(70, 20); 322 | this.captureX.TabIndex = 1; 323 | // 324 | // window 325 | // 326 | this.window.Controls.Add(this.colsNum); 327 | this.window.Controls.Add(this.rowsNum); 328 | this.window.Controls.Add(this.label7); 329 | this.window.Controls.Add(this.label8); 330 | this.window.Controls.Add(this.columns); 331 | this.window.Controls.Add(this.rows); 332 | this.window.Controls.Add(this.label6); 333 | this.window.Controls.Add(this.label5); 334 | this.window.Enabled = false; 335 | this.window.Location = new System.Drawing.Point(146, 146); 336 | this.window.Name = "window"; 337 | this.window.Size = new System.Drawing.Size(226, 79); 338 | this.window.TabIndex = 3; 339 | this.window.TabStop = false; 340 | this.window.Text = "Window Snapping"; 341 | this.window.Visible = false; 342 | // 343 | // colsNum 344 | // 345 | this.colsNum.Enabled = false; 346 | this.colsNum.Location = new System.Drawing.Point(160, 45); 347 | this.colsNum.Maximum = new decimal(new int[] { 348 | 32, 349 | 0, 350 | 0, 351 | 0}); 352 | this.colsNum.Minimum = new decimal(new int[] { 353 | 2, 354 | 0, 355 | 0, 356 | 0}); 357 | this.colsNum.Name = "colsNum"; 358 | this.colsNum.Size = new System.Drawing.Size(60, 20); 359 | this.colsNum.TabIndex = 16; 360 | this.colsNum.Value = new decimal(new int[] { 361 | 9, 362 | 0, 363 | 0, 364 | 0}); 365 | // 366 | // rowsNum 367 | // 368 | this.rowsNum.Enabled = false; 369 | this.rowsNum.Location = new System.Drawing.Point(160, 19); 370 | this.rowsNum.Maximum = new decimal(new int[] { 371 | 32, 372 | 0, 373 | 0, 374 | 0}); 375 | this.rowsNum.Minimum = new decimal(new int[] { 376 | 2, 377 | 0, 378 | 0, 379 | 0}); 380 | this.rowsNum.Name = "rowsNum"; 381 | this.rowsNum.Size = new System.Drawing.Size(60, 20); 382 | this.rowsNum.TabIndex = 15; 383 | this.rowsNum.Value = new decimal(new int[] { 384 | 5, 385 | 0, 386 | 0, 387 | 0}); 388 | // 389 | // label7 390 | // 391 | this.label7.AutoSize = true; 392 | this.label7.Location = new System.Drawing.Point(113, 47); 393 | this.label7.Name = "label7"; 394 | this.label7.Size = new System.Drawing.Size(37, 13); 395 | this.label7.TabIndex = 14; 396 | this.label7.Text = "# Cols"; 397 | // 398 | // label8 399 | // 400 | this.label8.AutoSize = true; 401 | this.label8.Location = new System.Drawing.Point(113, 21); 402 | this.label8.Name = "label8"; 403 | this.label8.Size = new System.Drawing.Size(44, 13); 404 | this.label8.TabIndex = 13; 405 | this.label8.Text = "# Rows"; 406 | // 407 | // columns 408 | // 409 | this.columns.Enabled = false; 410 | this.columns.Location = new System.Drawing.Point(56, 45); 411 | this.columns.Maximum = new decimal(new int[] { 412 | 32, 413 | 0, 414 | 0, 415 | 0}); 416 | this.columns.Minimum = new decimal(new int[] { 417 | 2, 418 | 0, 419 | 0, 420 | 0}); 421 | this.columns.Name = "columns"; 422 | this.columns.Size = new System.Drawing.Size(40, 20); 423 | this.columns.TabIndex = 12; 424 | this.columns.Value = new decimal(new int[] { 425 | 12, 426 | 0, 427 | 0, 428 | 0}); 429 | // 430 | // rows 431 | // 432 | this.rows.Enabled = false; 433 | this.rows.Location = new System.Drawing.Point(56, 19); 434 | this.rows.Maximum = new decimal(new int[] { 435 | 32, 436 | 0, 437 | 0, 438 | 0}); 439 | this.rows.Minimum = new decimal(new int[] { 440 | 2, 441 | 0, 442 | 0, 443 | 0}); 444 | this.rows.Name = "rows"; 445 | this.rows.Size = new System.Drawing.Size(40, 20); 446 | this.rows.TabIndex = 11; 447 | this.rows.Value = new decimal(new int[] { 448 | 8, 449 | 0, 450 | 0, 451 | 0}); 452 | // 453 | // label6 454 | // 455 | this.label6.AutoSize = true; 456 | this.label6.Location = new System.Drawing.Point(6, 47); 457 | this.label6.Name = "label6"; 458 | this.label6.Size = new System.Drawing.Size(47, 13); 459 | this.label6.TabIndex = 10; 460 | this.label6.Text = "Columns"; 461 | // 462 | // label5 463 | // 464 | this.label5.AutoSize = true; 465 | this.label5.Location = new System.Drawing.Point(6, 21); 466 | this.label5.Name = "label5"; 467 | this.label5.Size = new System.Drawing.Size(34, 13); 468 | this.label5.TabIndex = 9; 469 | this.label5.Text = "Rows"; 470 | // 471 | // notifyIcon 472 | // 473 | this.notifyIcon.ContextMenuStrip = this.contextMenuStrip; 474 | this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); 475 | this.notifyIcon.Text = "WinScroll"; 476 | this.notifyIcon.Visible = true; 477 | // 478 | // contextMenuStrip 479 | // 480 | this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 481 | this.optionsToolStripMenuItem, 482 | this.toolStripSeparator1, 483 | this.exitToolStripMenuItem}); 484 | this.contextMenuStrip.Name = "contextMenuStrip"; 485 | this.contextMenuStrip.Size = new System.Drawing.Size(117, 54); 486 | // 487 | // optionsToolStripMenuItem 488 | // 489 | this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; 490 | this.optionsToolStripMenuItem.Size = new System.Drawing.Size(116, 22); 491 | this.optionsToolStripMenuItem.Text = "Options"; 492 | // 493 | // toolStripSeparator1 494 | // 495 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 496 | this.toolStripSeparator1.Size = new System.Drawing.Size(113, 6); 497 | // 498 | // exitToolStripMenuItem 499 | // 500 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 501 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(116, 22); 502 | this.exitToolStripMenuItem.Text = "Exit"; 503 | // 504 | // label9 505 | // 506 | this.label9.AutoSize = true; 507 | this.label9.Location = new System.Drawing.Point(152, 120); 508 | this.label9.Name = "label9"; 509 | this.label9.Size = new System.Drawing.Size(165, 13); 510 | this.label9.TabIndex = 4; 511 | this.label9.Text = "Contributions welcome on Github."; 512 | // 513 | // label10 514 | // 515 | this.label10.AutoSize = true; 516 | this.label10.Location = new System.Drawing.Point(152, 98); 517 | this.label10.Name = "label10"; 518 | this.label10.Size = new System.Drawing.Size(155, 13); 519 | this.label10.TabIndex = 5; 520 | this.label10.Text = "Snapping options coming soon!"; 521 | // 522 | // WinScroll 523 | // 524 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 525 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 526 | this.ClientSize = new System.Drawing.Size(384, 182); 527 | this.Controls.Add(this.label10); 528 | this.Controls.Add(this.label9); 529 | this.Controls.Add(this.credit); 530 | this.Controls.Add(this.window); 531 | this.Controls.Add(this.cursor); 532 | this.Controls.Add(this.options); 533 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 534 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 535 | this.MaximizeBox = false; 536 | this.Name = "WinScroll"; 537 | this.ShowInTaskbar = false; 538 | this.Text = "WinScroll"; 539 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnClose); 540 | this.options.ResumeLayout(false); 541 | this.options.PerformLayout(); 542 | this.credit.ResumeLayout(false); 543 | this.credit.PerformLayout(); 544 | this.cursor.ResumeLayout(false); 545 | this.cursor.PerformLayout(); 546 | this.tableLayoutPanel.ResumeLayout(false); 547 | this.tableLayoutPanel.PerformLayout(); 548 | ((System.ComponentModel.ISupportInitialize)(this.captureHeight)).EndInit(); 549 | ((System.ComponentModel.ISupportInitialize)(this.captureWidth)).EndInit(); 550 | ((System.ComponentModel.ISupportInitialize)(this.captureY)).EndInit(); 551 | ((System.ComponentModel.ISupportInitialize)(this.captureX)).EndInit(); 552 | this.window.ResumeLayout(false); 553 | this.window.PerformLayout(); 554 | ((System.ComponentModel.ISupportInitialize)(this.colsNum)).EndInit(); 555 | ((System.ComponentModel.ISupportInitialize)(this.rowsNum)).EndInit(); 556 | ((System.ComponentModel.ISupportInitialize)(this.columns)).EndInit(); 557 | ((System.ComponentModel.ISupportInitialize)(this.rows)).EndInit(); 558 | this.contextMenuStrip.ResumeLayout(false); 559 | this.ResumeLayout(false); 560 | this.PerformLayout(); 561 | 562 | } 563 | 564 | #endregion 565 | 566 | private System.Windows.Forms.GroupBox options; 567 | private System.Windows.Forms.CheckBox startupCheck; 568 | private System.Windows.Forms.CheckBox trayCheck; 569 | private System.Windows.Forms.GroupBox credit; 570 | private System.Windows.Forms.LinkLabel aboutLink; 571 | private System.Windows.Forms.ToolTip tooltip; 572 | private System.Windows.Forms.GroupBox cursor; 573 | private System.Windows.Forms.GroupBox window; 574 | private System.Windows.Forms.CheckBox captureCheck; 575 | private System.Windows.Forms.NumericUpDown captureHeight; 576 | private System.Windows.Forms.Label label4; 577 | private System.Windows.Forms.NumericUpDown captureWidth; 578 | private System.Windows.Forms.Label label3; 579 | private System.Windows.Forms.Label label2; 580 | private System.Windows.Forms.Label label1; 581 | private System.Windows.Forms.NumericUpDown captureY; 582 | private System.Windows.Forms.NumericUpDown captureX; 583 | private System.Windows.Forms.NotifyIcon notifyIcon; 584 | private System.Windows.Forms.Label labelCoords; 585 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip; 586 | private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; 587 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 588 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 589 | private System.Windows.Forms.CheckBox windowCheck; 590 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 591 | private System.Windows.Forms.NumericUpDown columns; 592 | private System.Windows.Forms.Label label6; 593 | private System.Windows.Forms.Label label5; 594 | private System.Windows.Forms.NumericUpDown colsNum; 595 | private System.Windows.Forms.NumericUpDown rowsNum; 596 | private System.Windows.Forms.Label label7; 597 | private System.Windows.Forms.Label label8; 598 | private System.Windows.Forms.NumericUpDown rows; 599 | private System.Windows.Forms.Label label9; 600 | private System.Windows.Forms.Label label10; 601 | } 602 | } 603 | 604 | -------------------------------------------------------------------------------- /WinScroll/WinScroll.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | using System.Runtime.InteropServices; 13 | using Microsoft.Win32; 14 | using System.Diagnostics; 15 | using System.IO; 16 | //using Newtonsoft.Json; 17 | 18 | namespace WinScroll 19 | { 20 | public partial class WinScroll : Form 21 | { 22 | private System.Windows.Forms.Timer timer; 23 | private Rectangle captureRectangle; 24 | private Point p = new Point(); 25 | 26 | private const string versionString = "0.5"; 27 | private const string aboutURL = "http://www.github.com/Petethegoat"; 28 | //private const string apiURL = "https://api.github.com/repos/petethegoat/winscroll/releases/latest"; 29 | private const string registry = "SOFTWARE\\WinScroll"; 30 | private int leftArrow; 31 | private int upArrow; 32 | private int downArrow; 33 | private int rightArrow; 34 | 35 | private SnapLocation[] leftLocations = new SnapLocation[] { new SnapLocation(0,0,9,0) }; 36 | private SnapLocation[] upLocations = new SnapLocation[] { new SnapLocation(9,0,3,5), new SnapLocation(6,0,6,5), new SnapLocation(6,0,3,5)}; 37 | private SnapLocation[] downLocations = new SnapLocation[] { new SnapLocation(9,5,3,3,true), new SnapLocation(6,5,6,3,true), new SnapLocation(6,5,3,3,true) }; 38 | private SnapLocation[] rightLocations = new SnapLocation[] { new SnapLocation(9,0,3,0) }; 39 | 40 | public struct SnapLocation 41 | { 42 | public int x, y, width, height; 43 | public bool modulo; 44 | 45 | public SnapLocation(int c, int r, int w, int h) 46 | { 47 | x = c; 48 | y = r; 49 | width = w; 50 | height = h; 51 | modulo = false; 52 | } 53 | public SnapLocation(int c, int r, int w, int h, bool m) 54 | { 55 | x = c; 56 | y = r; 57 | width = w; 58 | height = h; 59 | modulo = m; 60 | } 61 | } 62 | 63 | public WinScroll() 64 | { 65 | leftArrow = "full_left".GetHashCode(); 66 | upArrow = "upper_right".GetHashCode(); 67 | downArrow = "lower_right".GetHashCode(); 68 | rightArrow = "full_right".GetHashCode(); 69 | 70 | InitializeComponent(); 71 | Init(); 72 | 73 | //SizeChanged += new System.EventHandler(formResize); 74 | Layout += new LayoutEventHandler(formResize); 75 | notifyIcon.DoubleClick += new System.EventHandler(windowShow); 76 | optionsToolStripMenuItem.Click += new System.EventHandler(windowShow); 77 | exitToolStripMenuItem.Click += new System.EventHandler(trayExit); 78 | 79 | captureX.LostFocus += new System.EventHandler(CaptureBounds); 80 | captureY.LostFocus += new System.EventHandler(CaptureBounds); 81 | captureWidth.LostFocus += new System.EventHandler(CaptureBounds); 82 | captureHeight.LostFocus += new System.EventHandler(CaptureBounds); 83 | 84 | captureCheck.CheckedChanged += new System.EventHandler(captureCheckChanged); 85 | trayCheck.CheckedChanged += new System.EventHandler(trayCheckChanged); 86 | startupCheck.CheckedChanged += new System.EventHandler(startupCheckChanged); 87 | windowCheck.CheckedChanged += new System.EventHandler(windowCheckChanged); 88 | 89 | aboutLink.Click += new System.EventHandler(aboutLinkClicked); 90 | } 91 | 92 | public void Init() 93 | { 94 | timer = new System.Windows.Forms.Timer(); 95 | timer.Tick += new EventHandler(Tick); 96 | timer.Interval = 10; 97 | 98 | captureRectangle = new Rectangle((int)captureX.Value, (int)captureY.Value, (int)captureWidth.Value, (int)captureHeight.Value); 99 | 100 | //Startup 101 | RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false); 102 | if(rk != null && rk.GetValue("WinScroll") != null) 103 | { 104 | startupCheck.Checked = true; 105 | WindowState = FormWindowState.Minimized; 106 | 107 | } 108 | //Loading 109 | rk = Registry.CurrentUser.CreateSubKey(registry); 110 | rk = Registry.CurrentUser.OpenSubKey(registry, false); 111 | if(rk != null) 112 | { 113 | object o = rk.GetValue("HideTrayIcon"); 114 | if(o != null && o.ToString() == "true") 115 | { 116 | trayCheck.Checked = true; 117 | notifyIcon.Visible = !trayCheck.Checked; 118 | } 119 | o = rk.GetValue("WindowSnapping"); 120 | if(o != null && o.ToString() == "true") 121 | { 122 | windowCheck.Checked = true; 123 | RegisterHotkeys(); 124 | } 125 | } 126 | 127 | //allow us to be run from explorer's 'Run' - http://stackoverflow.com/a/4822749 128 | rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\winscroll.exe"); 129 | if(rk != null) 130 | { 131 | rk.SetValue("", Application.ExecutablePath); 132 | rk.SetValue("Path", Path.GetDirectoryName(Application.ExecutablePath)); 133 | } 134 | 135 | //check for updates!!!! wowowwwow 136 | /* 137 | ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 138 | using(WebClient c = new WebClient()) 139 | { 140 | string data = c.DownloadString(apiURL); 141 | var json = JsonConvert.DeserializeObject>(data); 142 | string latestVersion = json["tag_name"]; 143 | Debug.WriteLine(latestVersion); 144 | } 145 | */ 146 | 147 | captureX.Value = Properties.Settings.Default.CaptureX; 148 | captureY.Value = Properties.Settings.Default.CaptureY; 149 | captureWidth.Value = Properties.Settings.Default.CaptureWidth; 150 | captureHeight.Value = Properties.Settings.Default.CaptureHeight; 151 | UpdateCaptureRect(); 152 | } 153 | 154 | private void Tick(object sender, EventArgs e) 155 | { 156 | NativeMethods.GetCursorPos(out p); 157 | labelCoords.Text = p.X.ToString() + ", " + p.Y.ToString(); 158 | UpdateCapture(captureCheck.Checked); 159 | } 160 | 161 | private void UpdateCapture(bool capture) 162 | { 163 | if(capture) 164 | { 165 | NativeMethods.ClipCursor(ref captureRectangle); 166 | NativeMethods.MoveWindow(Handle, (int) captureX.Value, (int) captureY.Value, 400, 220, true); 167 | } 168 | else 169 | { 170 | NativeMethods.ClipCursor(IntPtr.Zero); 171 | } 172 | } 173 | 174 | private void CaptureBounds(object sender, EventArgs e) 175 | { 176 | if(string.IsNullOrEmpty(((Control)captureX).Text)) 177 | ((Control)captureX).Text = captureX.Value.ToString(); 178 | 179 | if(string.IsNullOrEmpty(((Control)captureY).Text)) 180 | ((Control)captureY).Text = captureY.Value.ToString(); 181 | 182 | if(string.IsNullOrEmpty(((Control)captureWidth).Text)) 183 | ((Control)captureWidth).Text = captureWidth.Value.ToString(); 184 | 185 | if(string.IsNullOrEmpty(((Control)captureHeight).Text)) 186 | ((Control)captureHeight).Text = captureHeight.Value.ToString(); 187 | 188 | if(captureX.Value >= captureWidth.Value) 189 | { 190 | captureWidth.Value = captureX.Value + 1; 191 | } 192 | if(captureY.Value >= captureHeight.Value) 193 | { 194 | captureHeight.Value = captureY.Value + 1; 195 | } 196 | UpdateCaptureRect(); 197 | } 198 | 199 | private void UpdateCaptureRect() 200 | { 201 | captureRectangle = new Rectangle((int)captureX.Value, (int)captureY.Value, (int)captureWidth.Value, (int)captureHeight.Value); 202 | } 203 | 204 | private void captureCheckChanged(object sender, EventArgs e) 205 | { 206 | UpdateCapture(captureCheck.Checked); 207 | if(captureCheck.Checked) 208 | timer.Start(); 209 | else 210 | timer.Stop(); 211 | } 212 | 213 | private void trayCheckChanged(object sender, EventArgs e) 214 | { 215 | notifyIcon.Visible = !trayCheck.Checked; 216 | RegistryKey rk = Registry.CurrentUser.OpenSubKey(registry, true); 217 | if(rk != null) 218 | { 219 | rk.SetValue("HideTrayIcon", trayCheck.Checked ? "true" : "false"); 220 | } 221 | } 222 | 223 | private void startupCheckChanged(object sender, EventArgs e) 224 | { 225 | RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); 226 | 227 | if(startupCheck.Checked) 228 | rk.SetValue("WinScroll", Application.ExecutablePath.ToString()); 229 | else 230 | rk.DeleteValue("WinScroll", false); 231 | } 232 | 233 | private void windowShow(object sender, EventArgs e) 234 | { 235 | ShowWindow(); 236 | } 237 | 238 | private void trayExit(object sender, EventArgs e) 239 | { 240 | Close(); 241 | } 242 | 243 | private void formResize(object sender, EventArgs e) 244 | { 245 | //Debug.WriteLine(WindowState.ToString() + ", " + Visible.ToString()); 246 | if(WindowState == FormWindowState.Minimized) 247 | { 248 | Hide(); 249 | } 250 | //Debug.WriteLine(WindowState.ToString() + ", " + Visible.ToString()); 251 | } 252 | 253 | private void aboutLinkClicked(object sender, EventArgs e) 254 | { 255 | System.Diagnostics.Process.Start(aboutURL); 256 | } 257 | 258 | 259 | private void windowCheckChanged(object sender, EventArgs e) 260 | { 261 | RegisterHotkeys(); 262 | 263 | RegistryKey rk = Registry.CurrentUser.OpenSubKey(registry, true); 264 | if(rk != null) 265 | { 266 | rk.SetValue("WindowSnapping", windowCheck.Checked ? "true" : "false"); 267 | } 268 | } 269 | 270 | private void RegisterHotkeys() 271 | { 272 | if(windowCheck.Checked) 273 | { 274 | Keys k = Keys.Control | Keys.Alt | Keys.Left; 275 | Macro.RegisterHotKey(this, k, leftArrow); 276 | 277 | k = Keys.Control | Keys.Alt | Keys.Up; 278 | Macro.RegisterHotKey(this, k, upArrow); 279 | 280 | k = Keys.Control | Keys.Alt | Keys.Down; 281 | Macro.RegisterHotKey(this, k, downArrow); 282 | 283 | k = Keys.Control | Keys.Alt | Keys.Right; 284 | Macro.RegisterHotKey(this, k, rightArrow); 285 | } 286 | else 287 | { 288 | Macro.UnregisterHotKey(this, leftArrow); 289 | Macro.UnregisterHotKey(this, upArrow); 290 | Macro.UnregisterHotKey(this, downArrow); 291 | Macro.UnregisterHotKey(this, rightArrow); 292 | } 293 | } 294 | 295 | /* 296 | public static IntPtr WinGetHandle(string wName) 297 | { 298 | IntPtr hWnd = IntPtr.Zero; 299 | 300 | foreach(Process pList in Process.GetProcesses()) 301 | if(pList.MainWindowTitle.Contains(wName)) 302 | hWnd = pList.MainWindowHandle; 303 | 304 | return hWnd; 305 | } 306 | 307 | public static int HandleGetName(IntPtr hWnd) 308 | { 309 | foreach(Process pList in Process.GetProcesses()) 310 | if(pList.MainWindowHandle == hWnd) 311 | return pList.Id; 312 | 313 | return -1; 314 | } 315 | */ 316 | 317 | protected override void WndProc(ref Message m) 318 | { 319 | if(m.Msg == Macro.WM_HOTKEY) 320 | { 321 | Point p; 322 | NativeMethods.GetCursorPos(out p); 323 | Screen activeScreen = Screen.FromPoint(p); 324 | int screenWidth = activeScreen.WorkingArea.Width; 325 | int screenHeight = activeScreen.WorkingArea.Height; 326 | 327 | int col = (screenWidth / (int)columns.Value); 328 | int row = (screenHeight / (int)rows.Value); 329 | int w = 640; 330 | int h = 480; 331 | int x = 0; 332 | int y = 0; 333 | IntPtr window = NativeMethods.GetForegroundWindow(); 334 | 335 | Rect rect = new Rect(); 336 | NativeMethods.GetWindowRect(window, ref rect); 337 | 338 | /* 339 | Debug.Print(HandleGetName(window).ToString()); 340 | if(window.ToInt64() == 131262) //don't move the start menu! - needs work, apparently these IDs aren't consistent 341 | { 342 | return; 343 | } 344 | */ 345 | 346 | SnapLocation[] locations = leftLocations; 347 | 348 | if((int)m.WParam == leftArrow) 349 | locations = leftLocations; 350 | else if((int)m.WParam == upArrow) 351 | locations = upLocations; 352 | else if((int)m.WParam == downArrow) 353 | locations = downLocations; 354 | else if((int)m.WParam == rightArrow) 355 | locations = rightLocations; 356 | 357 | SnapLocation s; 358 | int result = 0; 359 | for(int i = 0; i < locations.Length; i++) 360 | { 361 | s = locations[i]; 362 | 363 | w = s.width == 0 ? screenWidth : col * s.width; 364 | if(s.modulo) 365 | h = s.height == 0 ? screenHeight : (row * s.height) + screenHeight % row; 366 | else 367 | h = s.height == 0 ? screenHeight : row * s.height; 368 | x = col * s.x + activeScreen.Bounds.Left; 369 | y = row * s.y; 370 | 371 | if(rect.Left == x && rect.Top == y && rect.Right == w + x && rect.Bottom == h + y) 372 | { 373 | result = i + 1; 374 | break; 375 | } 376 | } 377 | 378 | if(result >= locations.Length) 379 | result = 0; 380 | s = locations[result]; 381 | 382 | w = s.width == 0 ? screenWidth : col * s.width; 383 | if(s.modulo) 384 | h = s.height == 0 ? screenHeight : (row * s.height) + screenHeight % row; 385 | else 386 | h = s.height == 0 ? screenHeight : row * s.height; 387 | x = col * s.x + activeScreen.Bounds.Left; 388 | y = row * s.y; 389 | 390 | NativeMethods.MoveWindow(window, x, y, w, h, true); 391 | } 392 | else if(m.Msg == NativeMethods.WM_SHOWME) 393 | { 394 | ShowWindow(); 395 | } 396 | base.WndProc(ref m); 397 | } 398 | 399 | private void ShowWindow() 400 | { 401 | WindowState = FormWindowState.Maximized; //once again, not quite sure why this is necessary, but setting the state to normal straight away doesn't unhide correctly. 402 | Show(); 403 | BringToFront(); 404 | TopMost = true; //ensure we're right at the front! 405 | TopMost = false; //don't stay in front though, that'd be rude. 406 | Activate(); //and make sure we're focused after we've been called. 407 | WindowState = FormWindowState.Normal; 408 | } 409 | 410 | private void OnClose(object sender, FormClosedEventArgs e) 411 | { 412 | Properties.Settings.Default.CaptureX = captureX.Value; 413 | Properties.Settings.Default.CaptureY = captureY.Value; 414 | Properties.Settings.Default.CaptureWidth = captureWidth.Value; 415 | Properties.Settings.Default.CaptureHeight = captureHeight.Value; 416 | Properties.Settings.Default.Save(); 417 | } 418 | } 419 | } 420 | -------------------------------------------------------------------------------- /WinScroll/WinScroll.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3FAA0F95-F4F3-4820-B889-5C5864DD3A37} 8 | WinExe 9 | Properties 10 | WinScroll 11 | WinScroll 12 | v4.5 13 | 512 14 | false 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | true 29 | 30 | 31 | AnyCPU 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | AnyCPU 42 | pdbonly 43 | true 44 | bin\Release\ 45 | TRACE 46 | prompt 47 | 4 48 | 49 | 50 | winscroll.ico 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Form 69 | 70 | 71 | WinScroll.cs 72 | 73 | 74 | 75 | 76 | ResXFileCodeGenerator 77 | Resources.Designer.cs 78 | Designer 79 | 80 | 81 | True 82 | Resources.resx 83 | 84 | 85 | WinScroll.cs 86 | 87 | 88 | SettingsSingleFileGenerator 89 | Settings.Designer.cs 90 | 91 | 92 | True 93 | Settings.settings 94 | True 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | False 106 | Microsoft .NET Framework 4.5 %28x86 and x64%29 107 | true 108 | 109 | 110 | False 111 | .NET Framework 3.5 SP1 Client Profile 112 | false 113 | 114 | 115 | False 116 | .NET Framework 3.5 SP1 117 | false 118 | 119 | 120 | 121 | 128 | -------------------------------------------------------------------------------- /WinScroll/winscroll.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Petethegoat/WinScroll/ac87847e183cad5c4a22bcedc5a113f46a0c1fd2/WinScroll/winscroll.ico -------------------------------------------------------------------------------- /winscroll.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Petethegoat/WinScroll/ac87847e183cad5c4a22bcedc5a113f46a0c1fd2/winscroll.ico --------------------------------------------------------------------------------