Our members are dedicated to PASSION and PURPOSE without drama!

Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - VLS

#781
Code (csharp) Select
//' WIN32 API (Window handling)

        // Must have System.Runtime.InteropServices
        [DllImport("user32.dll")]
        extern static bool GetCursorPos(ref Point lpPoint);

        [StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {

            public int Left;
            public int Top;
            public int Right;

            public int Bottom;
            public Rectangle ToRectangle()
            {
                return new Rectangle(Left, Top, Right - Left, Bottom - Top);
            }

        }

        [DllImport("user32.dll")]
        extern static IntPtr WindowFromPoint(Point point);

        [DllImport("user32.dll")]
        extern static bool ScreenToClient(IntPtr handle, ref Point point);

        [DllImport("user32.dll")]
        extern static IntPtr ChildWindowFromPointEx(IntPtr hWndParent, Point pt, uint uFlags);

        [DllImport("user32.dll")]
        extern static bool ClientToScreen(IntPtr hwnd, ref Point lpPoint);

        [DllImport("user32.dll")]
        extern static bool IsChild(IntPtr hWndParent, IntPtr hWnd);

        [DllImport("user32.dll")]
        extern static IntPtr GetParent(IntPtr hWnd);

        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        extern static IntPtr GetAncestor(IntPtr hWnd, int flags);

        public enum GetAncestor_Flags
        {
            GetParent = 1,
            GetRoot = 2,
            GetRootOwner = 3
        }

        public enum GetWindow_Cmd : uint
        {
            GW_HWNDFIRST = 0,
            GW_HWNDLAST = 1,
            GW_HWNDNEXT = 2,
            GW_HWNDPREV = 3,
            GW_OWNER = 4,
            GW_CHILD = 5,
            GW_ENABLEDPOPUP = 6
        }

        [DllImport("user32.dll")]
        extern static IntPtr GetWindow(IntPtr hWnd, uint uCmd);

        [DllImport("user32.dll")]
        extern static bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);

        [DllImport("user32.dll")]
        extern static IntPtr GetWindowDC(IntPtr hWnd);

        [DllImport("user32.dll")]
        extern static int GetWindowTextLength(IntPtr hWnd);

        [DllImport("user32.dll")]
        extern static int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);

        [DllImport("user32.dll")]
        extern public static int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);

        [DllImport("user32.dll")]
        extern static Int32 ReleaseDC(IntPtr hWnd, IntPtr hdc);

        [DllImport("user32.dll", SetLastError = true)]
        private extern static int GetWindowLong(IntPtr hWnd, [MarshalAs(UnmanagedType.I4)]
WindowLongFlags nIndex);

        public enum WindowLongFlags : int
        {
            GWL_EXSTYLE = -20,
            GWLP_HINSTANCE = -6,
            GWLP_HWNDPARENT = -8,
            GWL_ID = -12,
            GWL_STYLE = -16,
            GWL_USERDATA = -21,
            GWL_WNDPROC = -4,
            DWLP_USER = 0x8,
            DWLP_MSGRESULT = 0x0,
            DWLP_DLGPROC = 0x4
        }

        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        extern static bool GetWindowRect(HandleRef hWnd, ref RECT lpRect);
        [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        // SetCursorPos
        extern static int SetCursorPos(int X, int Y);
        [DllImport("user32", EntryPoint = "mouse_event", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        // mouse_event
        extern static void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

        // mouse_event constants
        public const int MOUSEEVENTF_LEFTDOWN = 0x2;

        public const int MOUSEEVENTF_LEFTUP = 0x4;
        // Helper function returns a Rectangle object directly
        public static Rectangle GetWindowRect(IntPtr hWnd)
        {
            Debug.Assert(hWnd != IntPtr.Zero);
            RECT rect = new RECT();
            if (GetWindowRect(hWnd, ref rect) == false)
            {
                throw new Exception("GetWindowRect failed");
            }
            return rect.ToRectangle();
        }

        /// <summary>
        /// Gets window text (title) from passed window
        /// </summary>
        /// <param name="hWnd">Target window</param>
        /// <returns>String with text/title</returns>
        public static string GetWindowText(IntPtr hWnd)
        {
            Debug.Assert(hWnd != IntPtr.Zero);
            StringBuilder WindowText = new StringBuilder(GetWindowTextLength(hWnd) + 1);
            GetWindowText(hWnd, WindowText, WindowText.Capacity);
            return WindowText.ToString();
        }

        //' GDI (Graphics)

        public enum RopMode : int
        {
            R2_NOT = 6
        }

        [DllImport("gdi32.dll")]
        extern static int SetROP2(IntPtr hdc, int fnDrawMode);

        public enum PenStyles : int
        {
            PS_INSIDEFRAME = 6
        }
        [DllImport("gdi32.dll")]
        extern static IntPtr CreatePen(int fnPenStyle, int nWidth, uint crColor);

        [DllImport("gdi32.dll")]
        extern static IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);

        public enum StockObjects : int
        {
            NULL_BRUSH = 5
        }
        [DllImport("gdi32.dll")]
        extern static IntPtr GetStockObject(int fnObject);

        [DllImport("gdi32.dll")]
        extern static uint Rectangle(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);

        [DllImport("gdi32.dll")]
        extern static bool DeleteObject(IntPtr hObject);


        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool IsWindow(IntPtr hWnd);

        [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        extern static bool IsWindowVisible(IntPtr hwnd);
        [DllImport("user32", EntryPoint = "GetWindowTextA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern int GetWindowText(int hWnd, string lpString, int nMaxCount);
        [DllImport("gdi32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]


        ///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        private static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop);
        [DllImport("gdi32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        private static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, int nHeight);
        [DllImport("gdi32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        private static extern IntPtr CreateCompatibleDC(IntPtr hDC);
        [DllImport("gdi32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        private static extern bool DeleteDC(IntPtr hDC);


        private const int SRCCOPY = 0xcc0020;
        public static Image CaptureWindow(IntPtr handle)
        {

            // Check if it is a window for a start
            if (IsWindow(handle) == false)
            {
                // Clear picturebox
                //fCapture.BackgroundImage = null;

                // Halt
                return null;
            }

            // get te hDC of the target window
            IntPtr hdcSrc = GetWindowDC(handle);

            // get the size
            RECT windowRect = new RECT();

            GetWindowRect(handle, ref windowRect);

            int width = windowRect.Right - windowRect.Left;

            int height = windowRect.Bottom - windowRect.Top;

            // create a device context we can copy to
            IntPtr hdcDest = CreateCompatibleDC(hdcSrc);

            // create a bitmap we can copy it to,
            // using GetDeviceCaps to get the width/height
            IntPtr hBitmap = CreateCompatibleBitmap(hdcSrc, width, height);

            // select the bitmap object
            IntPtr hOld = SelectObject(hdcDest, hBitmap);

            // bitblt over
            BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, SRCCOPY);

            // restore selection
            SelectObject(hdcDest, hOld);

            // clean up
            DeleteDC(hdcDest);

            ReleaseDC(handle, hdcSrc);

            // get a .NET image object for it
            Image img = Image.FromHbitmap(hBitmap);

            // free up the Bitmap object
            DeleteObject(hBitmap);

            return img;

        }
        //CaptureWindow

        /// <summary>
        /// Paint a rect into the given window
        /// </summary>
        /// <param name="window">Pointer/Handle identifying window on which inverted rectangle is going to be painted</param>
        ///

        public static void ShowInvertRectTracker(IntPtr window)
        {

            if (window != IntPtr.Zero)
            {
                // get the coordinates from the window on the screen
                Rectangle WindowRect = GetWindowRect(window);

                // get the window's device context
                IntPtr dc = GetWindowDC(window);

                // Create an inverse pen that is the size of the window border
                SetROP2(dc, Convert.ToInt32(RopMode.R2_NOT));

                Color cColor = Color.FromArgb(0, 255, 0);
                IntPtr Pen = CreatePen(6, GetSystemMetrics(SystemMetric.SM_CXBORDER) * 3, Convert.ToUInt32(ColorTranslator.ToWin32(cColor)));

                // Draw the rectangle around the window
                IntPtr OldPen = SelectObject(dc, Pen);
                IntPtr OldBrush = SelectObject(dc, GetStockObject(Convert.ToInt32(StockObjects.NULL_BRUSH)));
                Rectangle(dc, 0, 0, WindowRect.Width, WindowRect.Height);

                SelectObject(dc, OldBrush);
                SelectObject(dc, OldPen);

                //release the device context, and destroy the pen
                ReleaseDC(window, dc);
                DeleteObject(Pen);
            }
        }
    }
}
#782
Win32

Code (csharp) Select
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;

namespace DefinitionsGenerator
{
    static class Win32
    {
        [Flags]
        public enum MouseEventFlags
        {
            LEFTDOWN = 0x00000002,
            LEFTUP = 0x00000004,
            MIDDLEDOWN = 0x00000020,
            MIDDLEUP = 0x00000040,
            MOVE = 0x00000001,
            ABSOLUTE = 0x00008000,
            RIGHTDOWN = 0x00000008,
            RIGHTUP = 0x00000010
        }

        public static void Click(int x, int y)
        {
            // Set cursor position
            Cursor.Position = new System.Drawing.Point(x, y);

            // Perform click
            mouse_event((int)(MouseEventFlags.LEFTDOWN), 0, 0, 0, 0);
            mouse_event((int)(MouseEventFlags.LEFTUP), 0, 0, 0, 0);
        }
       
        [DllImport("user32.dll")]
        static extern int GetSystemMetrics(SystemMetric smIndex);

        /// <summary>
        /// Flags used with the Windows API (User32.dll):GetSystemMetrics(SystemMetric smIndex)
        ///   
        /// This Enum and declaration signature was written by Gabriel T. Sharp
        /// ai_productions@verizon.net or osirisgothra@hotmail.com
        /// Obtained on pinvoke.net, please contribute your code to support the wiki!
        /// </summary>
        public enum SystemMetric : int
        {
            /// <summary>
            /// The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic.
            /// </summary>
            SM_ARRANGE = 56,

            /// <summary>
            /// The value that specifies how the system is started:
            /// 0 Normal boot
            /// 1 Fail-safe boot
            /// 2 Fail-safe with network boot
            /// A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files.
            /// </summary>
            SM_CLEANBOOT = 67,

            /// <summary>
            /// The number of display monitors on a desktop. For more information, see the Remarks section in this topic.
            /// </summary>
            SM_CMONITORS = 80,

            /// <summary>
            /// The number of buttons on a mouse, or zero if no mouse is installed.
            /// </summary>
            SM_CMOUSEBUTTONS = 43,

            /// <summary>
            /// The width of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look.
            /// </summary>
            SM_CXBORDER = 5,

            /// <summary>
            /// The width of a cursor, in pixels. The system cannot create cursors of other sizes.
            /// </summary>
            SM_CXCURSOR = 13,

            /// <summary>
            /// This value is the same as SM_CXFIXEDFRAME.
            /// </summary>
            SM_CXDLGFRAME = 7,

            /// <summary>
            /// The width of the rectangle around the location of a first click in a double-click sequence, in pixels. ,
            /// The second click must occur within the rectangle that is defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system
            /// to consider the two clicks a double-click. The two clicks must also occur within a specified time.
            /// To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH.
            /// </summary>
            SM_CXDOUBLECLK = 36,

            /// <summary>
            /// The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins.
            /// This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
            /// If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it.
            /// </summary>
            SM_CXDRAG = 68,

            /// <summary>
            /// The width of a 3-D border, in pixels. This metric is the 3-D counterpart of SM_CXBORDER.
            /// </summary>
            SM_CXEDGE = 45,

            /// <summary>
            /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels.
            /// SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border.
            /// This value is the same as SM_CXDLGFRAME.
            /// </summary>
            SM_CXFIXEDFRAME = 7,

            /// <summary>
            /// The width of the left and right edges of the focus rectangle that the DrawFocusRectdraws.
            /// This value is in pixels.
            /// Windows 2000:  This value is not supported.
            /// </summary>
            SM_CXFOCUSBORDER = 83,

            /// <summary>
            /// This value is the same as SM_CXSIZEFRAME.
            /// </summary>
            SM_CXFRAME = 32,

            /// <summary>
            /// The width of the client area for a full-screen window on the primary display monitor, in pixels.
            /// To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars,
            /// call the SystemParametersInfofunction with the SPI_GETWORKAREA value.
            /// </summary>
            SM_CXFULLSCREEN = 16,

            /// <summary>
            /// The width of the arrow bitmap on a horizontal scroll bar, in pixels.
            /// </summary>
            SM_CXHSCROLL = 21,

            /// <summary>
            /// The width of the thumb box in a horizontal scroll bar, in pixels.
            /// </summary>
            SM_CXHTHUMB = 10,

            /// <summary>
            /// The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions
            /// that SM_CXICON and SM_CYICON specifies.
            /// </summary>
            SM_CXICON = 11,

            /// <summary>
            /// The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size
            /// SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CXICON.
            /// </summary>
            SM_CXICONSPACING = 38,

            /// <summary>
            /// The default width, in pixels, of a maximized top-level window on the primary display monitor.
            /// </summary>
            SM_CXMAXIMIZED = 61,

            /// <summary>
            /// The default maximum width of a window that has a caption and sizing borders, in pixels.
            /// This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions.
            /// A window can override this value by processing the WM_GETMINMAXINFO message.
            /// </summary>
            SM_CXMAXTRACK = 59,

            /// <summary>
            /// The width of the default menu check-mark bitmap, in pixels.
            /// </summary>
            SM_CXMENUCHECK = 71,

            /// <summary>
            /// The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels.
            /// </summary>
            SM_CXMENUSIZE = 54,

            /// <summary>
            /// The minimum width of a window, in pixels.
            /// </summary>
            SM_CXMIN = 28,

            /// <summary>
            /// The width of a minimized window, in pixels.
            /// </summary>
            SM_CXMINIMIZED = 57,

            /// <summary>
            /// The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged.
            /// This value is always greater than or equal to SM_CXMINIMIZED.
            /// </summary>
            SM_CXMINSPACING = 47,

            /// <summary>
            /// The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions.
            /// A window can override this value by processing the WM_GETMINMAXINFO message.
            /// </summary>
            SM_CXMINTRACK = 34,

            /// <summary>
            /// The amount of border padding for captioned windows, in pixels. Windows XP/2000:  This value is not supported.
            /// </summary>
            SM_CXPADDEDBORDER = 92,

            /// <summary>
            /// The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling
            /// GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES).
            /// </summary>
            SM_CXSCREEN = 0,

            /// <summary>
            /// The width of a button in a window caption or title bar, in pixels.
            /// </summary>
            SM_CXSIZE = 30,

            /// <summary>
            /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels.
            /// SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
            /// This value is the same as SM_CXFRAME.
            /// </summary>
            SM_CXSIZEFRAME = 32,

            /// <summary>
            /// The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view.
            /// </summary>
            SM_CXSMICON = 49,

            /// <summary>
            /// The width of small caption buttons, in pixels.
            /// </summary>
            SM_CXSMSIZE = 52,

            /// <summary>
            /// The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors.
            /// The SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen.
            /// </summary>
            SM_CXVIRTUALSCREEN = 78,

            /// <summary>
            /// The width of a vertical scroll bar, in pixels.
            /// </summary>
            SM_CXVSCROLL = 2,

            /// <summary>
            /// The height of a window border, in pixels. This is equivalent to the SM_CYEDGE value for windows with the 3-D look.
            /// </summary>
            SM_CYBORDER = 6,

            /// <summary>
            /// The height of a caption area, in pixels.
            /// </summary>
            SM_CYCAPTION = 4,

            /// <summary>
            /// The height of a cursor, in pixels. The system cannot create cursors of other sizes.
            /// </summary>
            SM_CYCURSOR = 14,

            /// <summary>
            /// This value is the same as SM_CYFIXEDFRAME.
            /// </summary>
            SM_CYDLGFRAME = 8,

            /// <summary>
            /// The height of the rectangle around the location of a first click in a double-click sequence, in pixels.
            /// The second click must occur within the rectangle defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider
            /// the two clicks a double-click. The two clicks must also occur within a specified time. To set the height of the double-click
            /// rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT.
            /// </summary>
            SM_CYDOUBLECLK = 37,

            /// <summary>
            /// The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins.
            /// This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
            /// If this value is negative, it is subtracted from above the mouse-down point and added below it.
            /// </summary>
            SM_CYDRAG = 69,

            /// <summary>
            /// The height of a 3-D border, in pixels. This is the 3-D counterpart of SM_CYBORDER.
            /// </summary>
            SM_CYEDGE = 46,

            /// <summary>
            /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels.
            /// SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border.
            /// This value is the same as SM_CYDLGFRAME.
            /// </summary>
            SM_CYFIXEDFRAME = 8,

            /// <summary>
            /// The height of the top and bottom edges of the focus rectangle drawn byDrawFocusRect.
            /// This value is in pixels.
            /// Windows 2000:  This value is not supported.
            /// </summary>
            SM_CYFOCUSBORDER = 84,

            /// <summary>
            /// This value is the same as SM_CYSIZEFRAME.
            /// </summary>
            SM_CYFRAME = 33,

            /// <summary>
            /// The height of the client area for a full-screen window on the primary display monitor, in pixels.
            /// To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars,
            /// call the SystemParametersInfo function with the SPI_GETWORKAREA value.
            /// </summary>
            SM_CYFULLSCREEN = 17,

            /// <summary>
            /// The height of a horizontal scroll bar, in pixels.
            /// </summary>
            SM_CYHSCROLL = 3,

            /// <summary>
            /// The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions SM_CXICON and SM_CYICON.
            /// </summary>
            SM_CYICON = 12,

            /// <summary>
            /// The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size
            /// SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CYICON.
            /// </summary>
            SM_CYICONSPACING = 39,

            /// <summary>
            /// For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels.
            /// </summary>
            SM_CYKANJIWINDOW = 18,

            /// <summary>
            /// The default height, in pixels, of a maximized top-level window on the primary display monitor.
            /// </summary>
            SM_CYMAXIMIZED = 62,

            /// <summary>
            /// The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop.
            /// The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing
            /// the WM_GETMINMAXINFO message.
            /// </summary>
            SM_CYMAXTRACK = 60,

            /// <summary>
            /// The height of a single-line menu bar, in pixels.
            /// </summary>
            SM_CYMENU = 15,

            /// <summary>
            /// The height of the default menu check-mark bitmap, in pixels.
            /// </summary>
            SM_CYMENUCHECK = 72,

            /// <summary>
            /// The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels.
            /// </summary>
            SM_CYMENUSIZE = 55,

            /// <summary>
            /// The minimum height of a window, in pixels.
            /// </summary>
            SM_CYMIN = 29,

            /// <summary>
            /// The height of a minimized window, in pixels.
            /// </summary>
            SM_CYMINIMIZED = 58,

            /// <summary>
            /// The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged.
            /// This value is always greater than or equal to SM_CYMINIMIZED.
            /// </summary>
            SM_CYMINSPACING = 48,

            /// <summary>
            /// The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions.
            /// A window can override this value by processing the WM_GETMINMAXINFO message.
            /// </summary>
            SM_CYMINTRACK = 35,

            /// <summary>
            /// The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling
            /// GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES).
            /// </summary>
            SM_CYSCREEN = 1,

            /// <summary>
            /// The height of a button in a window caption or title bar, in pixels.
            /// </summary>
            SM_CYSIZE = 31,

            /// <summary>
            /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels.
            /// SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
            /// This value is the same as SM_CYFRAME.
            /// </summary>
            SM_CYSIZEFRAME = 33,

            /// <summary>
            /// The height of a small caption, in pixels.
            /// </summary>
            SM_CYSMCAPTION = 51,

            /// <summary>
            /// The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view.
            /// </summary>
            SM_CYSMICON = 50,

            /// <summary>
            /// The height of small caption buttons, in pixels.
            /// </summary>
            SM_CYSMSIZE = 53,

            /// <summary>
            /// The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors.
            /// The SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen.
            /// </summary>
            SM_CYVIRTUALSCREEN = 79,

            /// <summary>
            /// The height of the arrow bitmap on a vertical scroll bar, in pixels.
            /// </summary>
            SM_CYVSCROLL = 20,

            /// <summary>
            /// The height of the thumb box in a vertical scroll bar, in pixels.
            /// </summary>
            SM_CYVTHUMB = 9,

            /// <summary>
            /// Nonzero if User32.dll supports DBCS; otherwise, 0.
            /// </summary>
            SM_DBCSENABLED = 42,

            /// <summary>
            /// Nonzero if the debug version of User.exe is installed; otherwise, 0.
            /// </summary>
            SM_DEBUG = 22,

            /// <summary>
            /// Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input
            /// service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device.
            /// For more information, see Remarks.
            /// Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported.
            /// </summary>
            SM_DIGITIZER = 94,

            /// <summary>
            /// Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0.
            /// SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application.
            /// To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page.
            /// Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts
            /// or registry settings may not be present.
            /// </summary>
            SM_IMMENABLED = 82,

            /// <summary>
            /// Nonzero if there are digitizers in the system; otherwise, 0. SM_MAXIMUMTOUCHES returns the aggregate maximum of the
            /// maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers,
            /// the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts
            /// the hardware can provide. Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported.
            /// </summary>
            SM_MAXIMUMTOUCHES = 95,

            /// <summary>
            /// Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not.
            /// </summary>
            SM_MEDIACENTER = 87,

            /// <summary>
            /// Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned.
            /// </summary>
            SM_MENUDROPALIGNMENT = 40,

            /// <summary>
            /// Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not.
            /// </summary>
            SM_MIDEASTENABLED = 74,

            /// <summary>
            /// Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because
            /// some systems detect the presence of the port instead of the presence of a mouse.
            /// </summary>
            SM_MOUSEPRESENT = 19,

            /// <summary>
            /// Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0.
            /// </summary>
            SM_MOUSEHORIZONTALWHEELPRESENT = 91,

            /// <summary>
            /// Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0.
            /// </summary>
            SM_MOUSEWHEELPRESENT = 75,

            /// <summary>
            /// The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use.
            /// </summary>
            SM_NETWORK = 63,

            /// <summary>
            /// Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise.
            /// </summary>
            SM_PENWINDOWS = 41,

            /// <summary>
            /// This system metric is used in a Terminal Services environment to determine if the current Terminal Server session is
            /// being remotely controlled. Its value is nonzero if the current session is remotely controlled; otherwise, 0.
            /// You can use terminal services management tools such as Terminal Services Manager (tsadmin.msc) and shadow.exe to
            /// control a remote session. When a session is being remotely controlled, another user can view the contents of that session
            /// and potentially interact with it.
            /// </summary>
            SM_REMOTECONTROL = 0x2001,

            /// <summary>
            /// This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services
            /// client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session,
            /// the return value is 0.
            /// Windows Server 2003 and Windows XP:  The console session is not necessarily the physical console.
            /// For more information, seeWTSGetActiveConsoleSessionId.
            /// </summary>
            SM_REMOTESESSION = 0x1000,

            /// <summary>
            /// Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth,
            /// but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits,
            /// or those bits can be located in different places in a pixel color value.
            /// </summary>
            SM_SAMEDISPLAYFORMAT = 81,

            /// <summary>
            /// This system metric should be ignored; it always returns 0.
            /// </summary>
            SM_SECURE = 44,

            /// <summary>
            /// The build number if the system is Windows Server 2003 R2; otherwise, 0.
            /// </summary>
            SM_SERVERR2 = 89,

            /// <summary>
            /// Nonzero if the user requires an application to present information visually in situations where it would otherwise present
            /// the information only in audible form; otherwise, 0.
            /// </summary>
            SM_SHOWSOUNDS = 70,

            /// <summary>
            /// Nonzero if the current session is shutting down; otherwise, 0. Windows 2000:  This value is not supported.
            /// </summary>
            SM_SHUTTINGDOWN = 0x2000,

            /// <summary>
            /// Nonzero if the computer has a low-end (slow) processor; otherwise, 0.
            /// </summary>
            SM_SLOWMACHINE = 73,

            /// <summary>
            /// Nonzero if the current operating system is Windows 7 Starter Edition, Windows Vista Starter, or Windows XP Starter Edition; otherwise, 0.
            /// </summary>
            SM_STARTER = 88,

            /// <summary>
            /// Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0.
            /// </summary>
            SM_SWAPBUTTON = 23,

            /// <summary>
            /// Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista
            /// or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The SM_DIGITIZER setting indicates the type of digitizer
            /// input supported by a device running Windows 7 or Windows Server 2008 R2. For more information, see Remarks.
            /// </summary>
            SM_TABLETPC = 86,

            /// <summary>
            /// The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors.
            /// The SM_CXVIRTUALSCREEN metric is the width of the virtual screen.
            /// </summary>
            SM_XVIRTUALSCREEN = 76,

            /// <summary>
            /// The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors.
            /// The SM_CYVIRTUALSCREEN metric is the height of the virtual screen.
            /// </summary>
            SM_YVIRTUALSCREEN = 77,
        }

        /// <summary>
        /// Returns the window currently present below the cursor. i.e.
        /// </summary>
        /// <param name="point">Structure holding X, Y coordinates for current cursor location</param>
        /// <returns>IntPtr.Zero if no window was found</returns>
        public static IntPtr ChildWindowFromPoint(Point point)
        {

            IntPtr WindowPoint = WindowFromPoint(point);
            if (WindowPoint == IntPtr.Zero)
            {
                return IntPtr.Zero;
            }

            if (ScreenToClient(WindowPoint, ref point) == false)
            {
                throw new Exception("ScreenToClient failed");
            }

            IntPtr Window = ChildWindowFromPointEx(WindowPoint, point, 0);
            if (Window == IntPtr.Zero)
            {
                return WindowPoint;
            }

            if (ClientToScreen(WindowPoint, ref point) == false)
            {
                throw new Exception("ClientToScreen failed");
            }

            if (IsChild(GetParent(Window), Window) == false)
            {
                return Window;
            }

            // create a list to hold all childs under the point
            ArrayList WindowList = new ArrayList();
            while (Window != IntPtr.Zero)
            {
                Rectangle rect = GetWindowRect(Window);
                if (rect.Contains(point))
                {
                    WindowList.Add(Window);
                }
                Window = GetWindow(Window, Convert.ToUInt32(GetWindow_Cmd.GW_HWNDNEXT));
            }

            // search for the smallest window in the list
            int MinPixel = GetSystemMetrics(SystemMetric.SM_CXFULLSCREEN) * GetSystemMetrics(SystemMetric.SM_CYFULLSCREEN);
            for (int i = 0; i <= WindowList.Count - 1; i++)
            {
                Rectangle rect = GetWindowRect((IntPtr)WindowList[i]);
                int ChildPixel = rect.Width * rect.Height;
                if (ChildPixel < MinPixel)
                {
                    MinPixel = ChildPixel;
                    Window = (IntPtr)WindowList[i];
                }
            }

            return Window;
        }
#783
FormRectangle

Code (csharp) Select
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DefinitionsGenerator
{
    public partial class FormRectangle : Form
    {
        // Boolean for selection state
        bool selecting;

        // ints for point 1 and point 2
        int x1, y1, x2, y2;

        // Var to keep base image intact
        Bitmap bmBase;

        // Rectangle for crop
        Rectangle rect;

        /// <summary>
        /// Constructor
        /// </summary>
        public FormRectangle()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Prevents window from closing
        /// </summary>
        private void FormRectangle_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Set status to invisible
            this.Visible = false;

            // Cancel closing
            e.Cancel = true;
        }

        /// <summary>
        /// Sets image on picturebox
        /// </summary>
        /// <param name="img">The passed image</param>
        public void setPbRect(Image img)
        {
            // Set base image
            bmBase = new Bitmap(img);

            // Set picturebox image
            pbRect.Image = img;
        }

        /// <summary>
        /// Gets an image from currentyl selected rectangle
        /// </summary>
        /// <returns>image with cropped rectangle</returns>
        public Image getRectImg()
        {
            Bitmap bmCrop = bmBase.Clone(rect, bmBase.PixelFormat);
            return (Image)(bmCrop);
        }

        /// <summary>
        /// Handle MouseDown on pbRect
        /// </summary>
        private void pbRect_MouseDown(object sender, MouseEventArgs e)
        {
            // Toggle selection status
            selecting = true;

            // Set X1, Y1
            x1 = e.X;
            y1 = e.Y;
        }

        /// <summary>
        /// Handle MouseUp on pbRect
        /// </summary>
        private void pbRect_MouseUp(object sender, MouseEventArgs e)
        {
            // Set selection state
            selecting = false;
        }

        /// <summary>
        /// Handle MouseMove on pbRect
        /// </summary>
        private void pbRect_MouseMove(object sender, MouseEventArgs e)
        {
            // Proceed only if we are in selection state
            if (!selecting)
            {
                // Halt
                return;
            }

            // Set X2, Y2
            x2 = e.X;
            y2 = e.Y;

            // Get BitMap
            Bitmap bm = new Bitmap(bmBase);

            // Set graphics
            using (Graphics gr = Graphics.FromImage(bm))
            {
                // Set pen
                using (Pen pen = new Pen(Color.Red, 2))
                {
                    pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                    rect = new Rectangle(Math.Min(x1, x2), Math.Min(y1, y2), Math.Abs(x1 - x2), Math.Abs(y1 - y2));
                    gr.DrawRectangle(pen, rect);
                }
            }

            // Display the temporary bitmap.
            pbRect.Image = bm;

            // Update
            pbRect.Refresh();
        }

        /// <summary>
        /// Handle visible state toggling
        /// </summary>
        private void pbRect_VisibleChanged(object sender, EventArgs e)
        {
            // Check if it's becoming visible
            if (this.Visible)
            {
                // It is; center form
                this.CenterToScreen();
            }
        }
    }
}


FormCapture

Code (csharp) Select
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DefinitionsGenerator
{
    public partial class FormCapture : Form
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public FormCapture()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Prevents window from closing
        /// </summary>
        private void FormCapture_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Set status to invisible
            this.Visible = false;

            // Cancel closing
            e.Cancel = true;
        }


        /// <summary>
        /// Handle visible/invisible toggling
        /// </summary>
        private void FormCapture_VisibleChanged(object sender, EventArgs e)
        {
            // Check if it's becoming visible
            if (this.Visible)
            {
                // It is; center form
                this.CenterToScreen();
               
                // Prepare assigned on locations class
                Locations.clearAssigned();

                // Set title
                FormCapture_MouseMove(sender, new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, 0, 0, 0));
            }
        }

        /// <summary>
        /// Handles MouseMove
        /// </summary>
        private void FormCapture_MouseMove(object sender, MouseEventArgs e)
        {
            this.Text = "Please click on " + Locations.getNextLocation() + "   [x: " + e.X + ", y:" + e.Y + "]";
        }

        /// <summary>
        /// Handles MouseClick on form
        /// </summary>
        private void FormCapture_MouseClick(object sender, MouseEventArgs e)
        {
            // Check if it's a right click
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                // Undo
                Locations.undoAssigned();

                // Halt
                return;
            }
           
            // Add current location
            Locations.addAssigned(new Point(e.X, e.Y));

            // Check if it's the last one
            if (Locations.getNextLocation() == string.Empty)
            {
                // Coordinates are done
                this.Visible = false;
            }
        }
    }
}
#784
Locations:

Code (csharp) Select
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms; // DEBUG TIME ONLY, Remove

namespace DefinitionsGenerator
{
    static class Locations
    {
        /* Locations lists */

        // Numbers
        private static List<KeyValuePair<string, string>> numbers = new List<KeyValuePair<string, string>>();

        // Splits
        private static List<KeyValuePair<string, string>> splits = new List<KeyValuePair<string, string>>();

        // Streets
        private static List<KeyValuePair<string, string>> streets = new List<KeyValuePair<string, string>>();

        // Corners / Quads
        private static List<KeyValuePair<string, string>> corners = new List<KeyValuePair<string, string>>();

        // Lines / Double-streets
        private static List<KeyValuePair<string, string>> lines = new List<KeyValuePair<string, string>>();

        // Dozens and Columns
        private static List<KeyValuePair<string, string>> dc = new List<KeyValuePair<string, string>>();

        // Even chances
        private static List<KeyValuePair<string, string>> ec = new List<KeyValuePair<string, string>>();

        // Buttons
        private static List<KeyValuePair<string, string>> buttons = new List<KeyValuePair<string, string>>();

        // Chips
        private static List<KeyValuePair<string, string>> chips = new List<KeyValuePair<string, string>>();

        // All locations
        private static List<KeyValuePair<string, string>> all = new List<KeyValuePair<string, string>>();

        // Assigned locations dictionary
        private static Dictionary<string, Point> assigned = new Dictionary<string, Point>();

        // Last selected locations
        private static List<string> lastSelected = new List<string>();

        /// <summary>
        /// Static constructor
        /// </summary>
        static Locations()
        {
            /* Populate lists */

            // Numbers
            for (int n = 0; n <= 36; n++)
            {
                // Add current number
                numbers.Add(new KeyValuePair<string, string>(n.ToString(), "number " + n.ToString()));
            }

            // Splits
            splits.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("1-0", "split 1-0"),
                new KeyValuePair<string, string>("2-0", "split 2-0"),
                new KeyValuePair<string, string>("3-0", "split 3-0"),
                new KeyValuePair<string, string>("1-2", "split 3-0"),
                new KeyValuePair<string, string>("1-4", "split 1-4"),
                new KeyValuePair<string, string>("2-3", "split 2-3"),
                new KeyValuePair<string, string>("2-5", "split 2-5"),
                new KeyValuePair<string, string>("3-6", "split 3-6"),
                new KeyValuePair<string, string>("4-5", "split 4-5"),
                new KeyValuePair<string, string>("4-7", "split 4-7"),
                new KeyValuePair<string, string>("5-6", "split 5-6"),
                new KeyValuePair<string, string>("5-8", "split 5-8"),
                new KeyValuePair<string, string>("6-9", "split 6-9"),
                new KeyValuePair<string, string>("7-8", "split 7-8"),
                new KeyValuePair<string, string>("7-10", "split 7-10"),
                new KeyValuePair<string, string>("8-9", "split 8-9"),
                new KeyValuePair<string, string>("8-11", "split 8-11"),
                new KeyValuePair<string, string>("9-12", "split 9-12"),
                new KeyValuePair<string, string>("10-11", "split 10-11"),
                new KeyValuePair<string, string>("10-13", "split 10-13"),
                new KeyValuePair<string, string>("11-12", "split 11-12"),
                new KeyValuePair<string, string>("11-14", "split 11-14"),
                new KeyValuePair<string, string>("12-15", "split 12-15"),
                new KeyValuePair<string, string>("13-14", "split 13-14"),
                new KeyValuePair<string, string>("13-16", "split 13-16"),
                new KeyValuePair<string, string>("14-15", "split 14-15"),
                new KeyValuePair<string, string>("14-17", "split 14-17"),
                new KeyValuePair<string, string>("15-18", "split 15-18"),
                new KeyValuePair<string, string>("16-17", "split 16-17"),
                new KeyValuePair<string, string>("16-19", "split 16-19"),
                new KeyValuePair<string, string>("17-18", "split 17-18"),
                new KeyValuePair<string, string>("17-20", "split 17-20"),
                new KeyValuePair<string, string>("18-21", "split 18-21"),
                new KeyValuePair<string, string>("19-20", "split 19-20"),
                new KeyValuePair<string, string>("19-22", "split 19-22"),
                new KeyValuePair<string, string>("20-21", "split 20-21"),
                new KeyValuePair<string, string>("20-23", "split 20-23"),
                new KeyValuePair<string, string>("21-24", "split 21-24"),
                new KeyValuePair<string, string>("22-23", "split 22-23"),
                new KeyValuePair<string, string>("22-25", "split 22-25"),
                new KeyValuePair<string, string>("23-24", "split 23-24"),
                new KeyValuePair<string, string>("23-26", "split 23-26"),
                new KeyValuePair<string, string>("24-27", "split 24-27"),
                new KeyValuePair<string, string>("25-26", "split 25-26"),
                new KeyValuePair<string, string>("25-28", "split 25-28"),
                new KeyValuePair<string, string>("26-27", "split 26-27"),
                new KeyValuePair<string, string>("26-29", "split 26-29"),
                new KeyValuePair<string, string>("27-30", "split 27-30"),
                new KeyValuePair<string, string>("28-29", "split 28-29"),
                new KeyValuePair<string, string>("28-31", "split 28-31"),
                new KeyValuePair<string, string>("29-30", "split 29-30"),
                new KeyValuePair<string, string>("29-32", "split 29-32"),
                new KeyValuePair<string, string>("30-33", "split 30-33"),
                new KeyValuePair<string, string>("31-32", "split 31-32"),
                new KeyValuePair<string, string>("31-34", "split 31-34"),
                new KeyValuePair<string, string>("32-33", "split 32-33"),
                new KeyValuePair<string, string>("32-35", "split 32-35"),
                new KeyValuePair<string, string>("33-36", "split 33-36"),
                new KeyValuePair<string, string>("34-35", "split 34-35"),
                new KeyValuePair<string, string>("35-36", "split 35-36")});


            // Streets
            streets.AddRange(new KeyValuePair<string, string>[] {
               new KeyValuePair<string, string>("1-3", "street 1-3"),
                new KeyValuePair<string, string>("4-6", "street 4-6"),
                new KeyValuePair<string, string>("7-9", "street 7-9"),
                new KeyValuePair<string, string>("10-12", "street 10-12"),
                new KeyValuePair<string, string>("13-15", "street 13-15"),
                new KeyValuePair<string, string>("16-18", "street 16-18"),
                new KeyValuePair<string, string>("19-21", "street 19-21"),
                new KeyValuePair<string, string>("22-24", "street 22-24"),
                new KeyValuePair<string, string>("25-27", "street 25-27"),
                new KeyValuePair<string, string>("28-30", "street 28-30"),
                new KeyValuePair<string, string>("31-33", "street 31-33"),
                new KeyValuePair<string, string>("34-36", "street 34-36")});

            // Corners
            corners.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("1-5", "corner 1-5"),
                new KeyValuePair<string, string>("2-6", "corner 2-6"),
                new KeyValuePair<string, string>("4-8", "corner 4-8"),
                new KeyValuePair<string, string>("5-9", "corner 5-9"),
                new KeyValuePair<string, string>("7-11", "corner 7-11"),
                new KeyValuePair<string, string>("8-12", "corner 8-12"),
                new KeyValuePair<string, string>("10-14", "corner 10-14"),
                new KeyValuePair<string, string>("11-15", "corner 11-15"),
                new KeyValuePair<string, string>("13-17", "corner 13-17"),
                new KeyValuePair<string, string>("14-18", "corner 14-18"),
                new KeyValuePair<string, string>("16-20", "corner 16-20"),
                new KeyValuePair<string, string>("17-21", "corner 17-21"),
                new KeyValuePair<string, string>("19-23", "corner 19-23"),
                new KeyValuePair<string, string>("20-24", "corner 20-24"),
                new KeyValuePair<string, string>("22-26", "corner 22-26"),
                new KeyValuePair<string, string>("23-27", "corner 23-27"),
                new KeyValuePair<string, string>("25-29", "corner 25-29"),
                new KeyValuePair<string, string>("26-30", "corner 26-30"),
                new KeyValuePair<string, string>("28-32", "corner 28-32"),
                new KeyValuePair<string, string>("29-33", "corner 29-33"),
                new KeyValuePair<string, string>("31-35", "corner 31-35"),
                new KeyValuePair<string, string>("32-36", "corner 32-36")});

            // Lines
            lines.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("1-6", "line 1-6"),
                new KeyValuePair<string, string>("4-9", "line 4-9"),
                new KeyValuePair<string, string>("7-12", "line 7-12"),
                new KeyValuePair<string, string>("10-15", "line 10-15"),
                new KeyValuePair<string, string>("13-18", "line 13-18"),
                new KeyValuePair<string, string>("16-21", "line 16-21"),
                new KeyValuePair<string, string>("19-24", "line 19-24"),
                new KeyValuePair<string, string>("22-27", "line 22-27"),
                new KeyValuePair<string, string>("25-30", "line 25-30"),
                new KeyValuePair<string, string>("28-33", "line 28-33"),
                new KeyValuePair<string, string>("31-36", "line 31-36")});

            // Dozens and columns
            dc.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("1-12", "Dozen 1"),
                new KeyValuePair<string, string>("13-24", "Dozen 2"),
                new KeyValuePair<string, string>("25-36", "Dozen 3"),
                new KeyValuePair<string, string>("1-34", "Column 1"),
                new KeyValuePair<string, string>("2-35", "Column 2"),
                new KeyValuePair<string, string>("3-36", "Column 3")});

            // Even chances
            ec.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("low", "Low (1-18)"),
                new KeyValuePair<string, string>("high", "High (19-36)"),
                new KeyValuePair<string, string>("even", "Even"),
                new KeyValuePair<string, string>("odd", "Odd"),
                new KeyValuePair<string, string>("red", "Red"),
                new KeyValuePair<string, string>("black", "Black")});

            // Buttons
            buttons.AddRange(new KeyValuePair<string, string>[] {
                new KeyValuePair<string, string>("confirm", "Confirm"),
                new KeyValuePair<string, string>("rebet", "Rebet"),
                new KeyValuePair<string, string>("clear", "Clear")});
        }

        /// <summary>
        /// Clear list of chips
        /// </summary>
        public static void clearChips()
        {
            // Clear chips
            chips.Clear();
        }

        /// <summary>
        /// Adds chip to list
        /// </summary>
        /// <param name="chip">Chip to add</param>
        public static void addChip(string chipKey, string chipValue)
        {
            // Add passed chip
            chips.Add(new KeyValuePair<string, string>(chipKey, chipValue));
        }


        /// <summary>
        /// Sets "all" list
        /// </summary>
        public static void setAll(List<string> selected)
        {
            // Clear last selected
            lastSelected.Clear();
           
            // Set last selected
            lastSelected.AddRange(selected);
           
            // Clear "all" list
            all.Clear();

            /* Add passed selected locations */

            // Numbers
            if (selected.Contains("numbers"))
            {
                // Add numbers
                all.AddRange(numbers);
            }

            // Splits
            if (selected.Contains("splits"))
            {
                // Add splits
                all.AddRange(splits);
            }

            // Streets
            if (selected.Contains("streets"))
            {
                // Add streets
                all.AddRange(streets);
            }

            // Corners
            if (selected.Contains("corners"))
            {
                // Add corners
                all.AddRange(corners);
            }

            // Lines
            if (selected.Contains("lines"))
            {
                // Add lines
                all.AddRange(lines);
            }

            // dc
            if (selected.Contains("dc"))
            {
                // Add Dozens and columns
                all.AddRange(dc);
            }

            // ec
            if (selected.Contains("ec"))
            {
                // Add even chances
                all.AddRange(ec);
            }

            // Buttons
            if (selected.Contains("buttons"))
            {
                // Add buttons
                all.AddRange(buttons);
            }

            // Chips
            if (selected.Contains("chips"))
            {
                // Add chips
                all.AddRange(chips);
            }
        }

        /// <summary>
        /// Clears assigned dictionary
        /// </summary>
        public static void clearAssigned()
        {
            // Clear it
            assigned.Clear();
        }

        /// <summary>
        /// Adds new name/coord pair to assigned dictionary
        /// </summary>
        /// <param name="coord">coordinates for location</param>
        public static void addAssigned(Point coord)
        {
            // Assign
            assigned.Add(all[assigned.Count].Key, coord);
        }

        /// <summary>
        /// Takes one from assigned
        /// </summary>
        public static void undoAssigned()
        {
            // Check there is something to undo
            if (assigned.Count == 0)
            {
                // Halt
                return;
            }
           
            // Remove last one from assigned
            assigned.Remove(all[assigned.Count - 1].Key);
        }

        /// <summary>
        /// Gets the display name for the next location to add
        /// </summary>
        /// <returns>string with the display name of the next location in line</returns>
        public static string getNextLocation()
        {
            // Check if count is still within list' boundaries
            if (assigned.Count == all.Count)
            {
                // Return empty string
                return string.Empty;
            }

            // Return next
            return all[assigned.Count].Value;
        }
    }
}


#785
Relevant sources below.


Main form:
Code (csharp) Select
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace DefinitionsGenerator
{
    public partial class Form1 : Form
    {
        // intPtr holding Last Window
        public IntPtr LastWindow = IntPtr.Zero;

        // Capture window
        FormCapture fCapture = new FormCapture();

        // Rectangle window
        FormRectangle fRectangle = new FormRectangle();

        // Last selected items
        int lastKeyword, lastLocation = -1;

        // List of bitmap for saved numbers
        List<Image> numbers = new List<Image>();

        /// <summary>
        /// Constructor
        /// </summary>
        public Form1()
        {
            // Initialize
            InitializeComponent();

            // Attach VisibleChanged handler to event in capture form
            fCapture.VisibleChanged += new EventHandler(this.fCapture_VisibleChanged);

            // Attach to rectangle form
            fRectangle.VisibleChanged += new EventHandler(this.fRectangle_VisibleChanged);   

            // Set capture form icon
            fCapture.Icon = this.Icon;

            // Set rectangle form icon
            fRectangle.Icon = this.Icon;

            // Insert 37 empty images in list
            for (int i = 0; i < 37; i++)
            {
                // Use resource image for padding
                numbers.Add(Properties.Resources.transparent);
            }
        }

        /// <summary>
        /// Handle MouseDown on Scope
        /// </summary>
        private void pbCursor_MouseDown(object sender, MouseEventArgs e)
        {
            // Set cursor
            Cursor = new Cursor(new System.IO.MemoryStream(Properties.Resources.searchw));

            // Change image to blank background one
            pbCursor.Image = Properties.Resources.findere;
        }

        /// <summary>
        /// Handle MouseMove on Scope
        /// </summary>
        private void pbCursor_MouseMove(object sender, MouseEventArgs e)
        {
            if (Cursor != Cursors.Default)
            {
                // We are, determine found window
                IntPtr FoundWindow = Win32.ChildWindowFromPoint(Cursor.Position);

                // Not this application
                if (Control.FromHandle(FoundWindow) == null)
                {
                    // Not an already-processed window
                    if (FoundWindow != LastWindow)
                    {
                        // clear old window
                        Win32.ShowInvertRectTracker(LastWindow);

                        // Set new window
                        LastWindow = FoundWindow;

                        // Paint inverted rectangle on new window
                        Win32.ShowInvertRectTracker(LastWindow);
                    }
                }

            }
        }

        /// <summary>
        /// Handle MouseUp on Scope
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbCursor_MouseUp(object sender, MouseEventArgs e)
        {
            // Check if it's done
            if (Cursor != Cursors.Default)
            {
                // Invert last window back
                Win32.ShowInvertRectTracker(LastWindow);

                // Change image back
                pbCursor.Image = Properties.Resources.finderf;

                // Change cursor back
                Cursor = Cursors.Default;

                /* Set title */
                string title = Win32.GetWindowText(LastWindow);

                // Check if there is some length to work with
                if (title.Length == 0)
                {
                    // Nothing to do, advice user
                    MessageBox.Show("No window title present.", "Empty title", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    // Exit
                    return;
                }

                // Enable keywords listbox
                if (!clbKeywords.Enabled)
                {
                    clbKeywords.Enabled = true;
                }

                // Clear keywords list
                clbKeywords.Items.Clear();

                // Set keywords
                string[] keywords = Regex.Split(title, @"\W");

                // Assign keywords to list
                clbKeywords.Items.AddRange(keywords);

                // Capture image
                Image img = Win32.CaptureWindow(LastWindow);

                // Set coordinates capture form's background
                fCapture.BackgroundImage = img;

                // Set its width and height
                fCapture.ClientSize = new Size(img.Width, img.Height);

                // Set rectangle form's picturebox image
                fRectangle.setPbRect(img);

                // Set its width and height
                fRectangle.ClientSize = new Size(img.Width, img.Height);

                // Reset last window
                LastWindow = IntPtr.Zero;
            }
        }

        /// <summary>
        /// Toggle currently selected item on CheckedListBox
        /// </summary>
        /// <param name="sender">Passed CheckedListBox</param>
        private void ToggleSelected(object sender)
        {
            // Check index is valid
            if (((CheckedListBox)sender).SelectedIndex > -1)
            {
                // Reverse checked status
                ((CheckedListBox)sender).SetItemChecked(((CheckedListBox)sender).SelectedIndex, !((CheckedListBox)sender).GetItemChecked(((CheckedListBox)sender).SelectedIndex));
            }
        }

        /// <summary>
        /// A secondary handler for visibility toggling on capture form
        /// </summary>
        private void fCapture_VisibleChanged(object sender, EventArgs e)
        {
            // Check if it's invisible
            if (fCapture.Visible == false)
            {
                // Activate set rectangle button
                bSetRectangle.Enabled = true;
            }           
        }

        /// <summary>
        /// A secondary handler for visibility toggling on rectangle form
        /// </summary>
        private void fRectangle_VisibleChanged(object sender, EventArgs e)
        {
            // Check if it's invisible
            if (fRectangle.Visible == false)
            {
                // Set ret image
                pbCrop.Image = fRectangle.getRectImg();
               
                // Activate define button
                bDefine.Enabled = true;

                // Activate library ListBox
                clbLibrary.Enabled = true;
            }
        }

        /// <summary>
        /// Handle click on keywords CheckedListBox
        /// </summary>
        private void clbKeywords_Click(object sender, EventArgs e)
        {
            // Act only on newly selected items
            if (lastKeyword != ((CheckedListBox)sender).SelectedIndex)
            {
                // Toggle selected item
                ToggleSelected(sender);

                // Set last keyword
                lastKeyword = ((CheckedListBox)sender).SelectedIndex;
            }

            // Enable locations listbox
            if (clbKeywords.SelectedIndex > -1 && !clbLocations.Enabled)
            {
                clbLocations.Enabled = true;
            }
        }

        /// <summary>
        /// Handle click on locations CheckedListBox
        /// </summary>
        private void clbLocations_Click(object sender, EventArgs e)
        {
            // Act only on newly selected items
            if (lastLocation != ((CheckedListBox)sender).SelectedIndex)
            {
                // Toggle selected item
                ToggleSelected(sender);

                // Set last location
                lastLocation = ((CheckedListBox)sender).SelectedIndex;
            }

            // Enable set locations button
            if (clbLocations.SelectedIndex > -1 && !bSetLocations.Enabled)
            {
                bSetLocations.Enabled = true;
            }
        }

        /// <summary>
        /// Start coordinates process
        /// </summary>
        private void bSetLocations_Click(object sender, EventArgs e)
        {
            // If user wants to set chips
            if (clbLocations.GetSelected()
            {
                // String to hold InputBox value
                string value = string.Empty;

                // Ask how many chips are going to be set
                InputBox.Show("Casino chips", "How many chips are you going to set?", ref value);

                // Int to hold the amount of chips
                int chipsAmount;

                // Try to parse the chips amount from assigned value
                Int32.TryParse(value, out chipsAmount);

                // Check there's something to work with
                if (chipsAmount > 0)
                {
                    // Clear chips list
                    Locations.clearChips();

                    // Ask for chips' values
                    for (int c = 0; c < chipsAmount; c++)
                    {
                        // Int to hold current chip value
                        double currentChip = 0.0;

                        // Reset value
                        value = string.Empty;

                        // Assign current one
                        InputBox.Show("Define chip", "Set value for chip #" + (c + 1).ToString(), ref value);

                        // Try to parse the current chip's amount from assigned value
                        Double.TryParse(value, out currentChip);

                        // Assign current value
                        Locations.addChip(currentChip.ToString(), "Chip " + currentChip.ToString());
                    }
                }
            }

            // List for selected locations
            List<string> selected = new List<string>();

            // Prepare selected locations list
            for (int i = 0; i < clbLocations.Items.Count; i++)
            {
                // Test current i
                switch (i)
                {
                    // Numbers
                    case 0:
                        // Check
                        if (clbLocations.GetItemChecked(0))
                        {
                            // Add
                            selected.Add("numbers");
                        }

                        // Halt
                        break;
                    // Splits
                    case 1:
                        // Check
                        if (clbLocations.GetItemChecked(1))
                        {
                            // Add
                            selected.Add("splits");
                        }

                        // Halt
                        break;
                    // Streets
                    case 2:
                        // Check
                        if (clbLocations.GetItemChecked(2))
                        {
                            // Add
                            selected.Add("streets");
                        }

                        // Halt
                        break;
                    // Corners
                    case 3:
                        // Check
                        if (clbLocations.GetItemChecked(3))
                        {
                            // Add
                            selected.Add("corners");
                        }

                        // Halt
                        break;
                    // Lines
                    case 4:
                        // Check
                        if (clbLocations.GetItemChecked(4))
                        {
                            // Add
                            selected.Add("lines");
                        }

                        // Halt
                        break;
                    // Dozens and colunms
                    case 5:
                        // Check
                        if (clbLocations.GetItemChecked(5))
                        {
                            // Add
                            selected.Add("dc");
                        }

                        // Halt
                        break;
                    // Even chances
                    case 6:
                        // Check
                        if (clbLocations.GetItemChecked(6))
                        {
                            // Add
                            selected.Add("ec");
                        }

                        // Halt
                        break;
                    // Casino buttons
                    case 7:
                        // Check
                        if (clbLocations.GetItemChecked(7))
                        {
                            // Add
                            selected.Add("buttons");
                        }

                        // Halt
                        break;
                    // Chips
                    case 8:
                        // Check
                        if (clbLocations.GetItemChecked()
                        {
                            // Add
                            selected.Add("chips");
                        }

                        // Halt
                        break;
                }
            }

            // Set all locations
            Locations.setAll(selected);

            // Set fCapture to visible
            fCapture.Visible = true;
        }

        /// <summary>
        /// Set rectangle form visible
        /// </summary>
        private void bSetRectangle_Click(object sender, EventArgs e)
        {
            // Set it
            fRectangle.Visible = true;
        }

        /// <summary>
        /// Ask for current number
        /// </summary>
        private void bDefine_Click(object sender, EventArgs e)
        {
            // String to hold InputBox value
            string value = string.Empty;

            // Ask how many chips are going to be set
            InputBox.Show("Set number", "Which number is it?", ref value);

            // Int to hold the amount of chips
            int number;

            // Try to parse the chips amount from assigned value
            Int32.TryParse(value, out number);

            // Check number
            if (number > -1 && number < 36)
            {
                // Assign
                numbers[number] = fRectangle.getRectImg();

                // Tick in library
                clbLibrary.SetItemChecked(number, true);
            }
        }

        /// <summary>
        /// Display current image from library
        /// </summary>
        private void clbLibrary_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Display image from current index
            pbLibrary.Image = numbers[((CheckedListBox)sender).SelectedIndex];
        }
    }
}
#786
This is the first Alpha for our new Definitions Generator (for enabling an Universal Clicker + OCR). Its mission is to empower people to configure the settings for any casino without having to wait for the programmer to update the clicker/bot.

Feedback from first users is needed.

Sponsor download: [attachmini=1]

#787
Gambling Philosophy / Re: Is there a causeless effect?
August 06, 2013, 05:53:45 PM
"Cleaning up" == issue bans, right?
#788
Development / Re: [ALPHA] New Lw tracker
August 06, 2013, 03:24:35 PM
Quote from: TwoCatSam on August 05, 2013, 11:45:01 PMThe "undo" seems to work perfectly.

Good to know.

Next we make the windows be "sticky" and let the generated Lw's accommodate current width. Then we move this to BETA to make it closer to a release for the whole community to enjoy.




Quote from: TwoCatSam on August 05, 2013, 11:45:01 PMI have one suggestion:  Change that blue to clear.  Then it would be uniform.
The "blue one" is for people to highlight one of the four by clicking on it.

Check it out. You might like it --or perhaps making a setting to toggle it on/off(?)
#790
Tutorials & Snippets / Re: Betting Locations
August 05, 2013, 04:37:25 PM
Lines:

1-6
4-9
7-12
10-15
13-18
16-21
19-24
22-27
25-30
28-33
31-36
#791
Tutorials & Snippets / Re: Betting Locations
August 05, 2013, 04:30:33 PM
Corners:

1-5
2-6
4-8
5-9
7-11
8-12
10-14
11-15
13-17
14-18
16-20
17-21
19-23
20-24
22-26
23-27
25-29
26-30
28-32
29-33
31-35
32-36
#792
A fellow friend needed this since the thread lost format at the source web:

[csv=,]Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Number1,,329140,,329891.89,,-1.33,,1,,4,,57,,1,,521
Number2,,330289,,329891.89,,0.70,,1,,4,,91,,1,,439
Number3,,329463,,329891.89,,-0.76,,1,,4,,28,,1,,454
Number4,,329665,,329891.89,,-0.40,,1,,4,,60,,1,,474
Number5,,329599,,329891.89,,-0.52,,1,,4,,52,,1,,485
Number6,,329653,,329891.89,,-0.42,,1,,4,,8,,1,,509
Number7,,329611,,329891.89,,-0.50,,1,,4,,1,,1,,417
Number8,,329888,,329891.89,,-0.01,,1,,5,,24,,1,,479
Number9,,330698,,329891.89,,1.42,,1,,4,,4,,1,,583
Number10,,329251,,329891.89,,-1.13,,1,,4,,26,,1,,487
Number11,,330205,,329891.89,,0.55,,1,,4,,77,,1,,509
Number12,,329153,,329891.89,,-1.30,,1,,4,,21,,1,,592
Number13,,329514,,329891.89,,-0.67,,1,,5,,9,,1,,557
Number14,,330578,,329891.89,,1.21,,1,,4,,92,,1,,503
Number15,,328972,,329891.89,,-1.62,,1,,5,,35,,1,,593
Number16,,330163,,329891.89,,0.48,,1,,4,,5,,1,,543
Number17,,330770,,329891.89,,1.55,,1,,4,,36,,1,,493
Number18,,331100,,329891.89,,2.13,,1,,4,,51,,1,,494
Number19,,329811,,329891.89,,-0.14,,1,,4,,13,,1,,534
Number20,,330795,,329891.89,,1.59,,1,,4,,31,,1,,497
Number21,,329942,,329891.89,,0.09,,1,,4,,27,,1,,478
Number22,,330463,,329891.89,,1.01,,1,,4,,73,,1,,482
Number23,,330435,,329891.89,,0.96,,1,,4,,18,,1,,423
Number24,,330425,,329891.89,,0.94,,1,,5,,10,,1,,456
Number25,,330613,,329891.89,,1.27,,1,,5,,96,,1,,431
Number26,,329830,,329891.89,,-0.11,,1,,4,,43,,1,,566
Number27,,329209,,329891.89,,-1.21,,1,,4,,7,,1,,474
Number28,,328879,,329891.89,,-1.79,,1,,5,,137,,1,,528
Number29,,329263,,329891.89,,-1.11,,1,,4,,29,,1,,521
Number30,,329393,,329891.89,,-0.88,,1,,4,,38,,1,,474
Number31,,329227,,329891.89,,-1.17,,1,,4,,3,,1,,463
Number32,,328926,,329891.89,,-1.70,,1,,4,,0,,1,,462
Number33,,330788,,329891.89,,1.58,,1,,4,,2,,1,,482
Number34,,329894,,329891.89,,0.00,,1,,4,,34,,1,,488
Number35,,329039,,329891.89,,-1.51,,1,,5,,20,,1,,491
Number36,,330541,,329891.89,,1.15,,1,,5,,22,,1,,452
Zero,,330815,,329891.89,,1.63,,1,,4,,47,,1,,539[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Low(1-18),,5937712,,5938054.05,,-0.20,,1,,22,,1,,1,,25
High(19-36),,5937473,,5938054.05,,-0.33,,1,,22,,0,,1,,23
Red,,5938269,,5938054.05,,0.12,,1,,22,,0,,1,,23
Black,,5936916,,5938054.05,,-0.65,,1,,21,,2,,1,,29
Odd,,5936299,,5938054.05,,-1.01,,1,,21,,1,,1,,24
Even,,5938886,,5938054.05,,0.48,,1,,23,,0,,1,,23
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
1st Dozen,,3956615,,3958702.70,,-1.28,,1,,18,,1,,1,,39
2nd Dozen,,3962968,,3958702.70,,2.61,,1,,14,,5,,1,,39
3rd Dozen,,3955602,,3958702.70,,-1.90,,1,,14,,0,,1,,39
Column A,,3956231,,3958702.70,,-1.51,,1,,14,,1,,1,,37
Column B,,3959617,,3958702.70,,0.56,,1,,13,,0,,1,,41
Column C,,3959337,,3958702.70,,0.39,,1,,16,,2,,1,,42
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Street(1-3),,988892,,989675.68,,-0.82,,1,,7,,28,,1,,168
Street(4-6),,988917,,989675.68,,-0.80,,1,,6,,8,,1,,174
Street(7-9),,990197,,989675.68,,0.55,,1,,6,,1,,1,,154
Street(10-12),,988609,,989675.68,,-1.12,,1,,7,,21,,1,,164
Street(13-15),,989064,,989675.68,,-0.64,,1,,6,,9,,1,,177
Street(16-18),,992033,,989675.68,,2.47,,1,,6,,5,,1,,165
Street(19-21),,990548,,989675.68,,0.91,,1,,7,,13,,1,,164
Street(22-24),,991323,,989675.68,,1.73,,1,,6,,10,,1,,160
Street(25-27),,989652,,989675.68,,-0.02,,1,,6,,7,,1,,174
Street(28-30),,987535,,989675.68,,-2.24,,1,,6,,29,,1,,178
Street(31-33),,988941,,989675.68,,-0.77,,1,,6,,0,,1,,164
Street(34-36),,989474,,989675.68,,-0.21,,1,,6,,20,,1,,163
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Line(1-6),,1977809,,1979351.35,,-1.20,,1,,8,,8,,1,,92
Line(4-9),,1979114,,1979351.35,,-0.18,,1,,8,,1,,1,,79
Line(7-12),,1978806,,1979351.35,,-0.42,,1,,8,,1,,1,,93
Line(10-15),,1977673,,1979351.35,,-1.30,,1,,9,,9,,1,,82
Line(13-18),,1981097,,1979351.35,,1.36,,1,,8,,5,,1,,89
Line(16-21),,1982581,,1979351.35,,2.51,,1,,9,,5,,1,,83
Line(19-24),,1981871,,1979351.35,,1.96,,1,,8,,10,,1,,76
Line(22-27),,1980975,,1979351.35,,1.26,,1,,9,,7,,1,,82
Line(25-30),,1977187,,1979351.35,,-1.68,,1,,8,,7,,1,,89
Line(28-33),,1976476,,1979351.35,,-2.23,,1,,10,,0,,1,,79
Line(31-36),,1978415,,1979351.35,,-0.73,,1,,9,,0,,1,,75
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Corner( 1:5 ),,1318693,,1319567.57,,-0.81,,1,,7,,52,,1,,120
Corner( 2:6 ),,1319004,,1319567.57,,-0.52,,1,,7,,8,,1,,120
Corner( 4:8 ),,1318763,,1319567.57,,-0.74,,1,,7,,1,,1,,124
Corner( 5:9 ),,1319838,,1319567.57,,0.25,,1,,7,,4,,1,,129
Corner( 7:11 ),,1318955,,1319567.57,,-0.56,,1,,6,,1,,1,,119
Corner( 8:12 ),,1319944,,1319567.57,,0.35,,1,,7,,4,,1,,127
Corner( 10:14 ),,1319548,,1319567.57,,-0.02,,1,,7,,9,,1,,151
Corner( 11:15 ),,1318908,,1319567.57,,-0.61,,1,,7,,21,,1,,126
Corner( 13:17 ),,1321025,,1319567.57,,1.34,,1,,7,,5,,1,,127
Corner( 14:18 ),,1321420,,1319567.57,,1.71,,1,,7,,35,,1,,137
Corner( 16:20 ),,1321539,,1319567.57,,1.82,,1,,6,,5,,1,,115
Corner( 17:21 ),,1322607,,1319567.57,,2.80,,1,,7,,27,,1,,130
Corner( 19:23 ),,1321504,,1319567.57,,1.78,,1,,7,,13,,1,,122
Corner( 20:24 ),,1321597,,1319567.57,,1.87,,1,,8,,10,,1,,120
Corner( 22:26 ),,1321341,,1319567.57,,1.63,,1,,7,,18,,1,,154
Corner( 23:27 ),,1319899,,1319567.57,,0.31,,1,,7,,7,,1,,124
Corner( 25:29 ),,1318585,,1319567.57,,-0.91,,1,,7,,29,,1,,138
Corner( 26:30 ),,1317695,,1319567.57,,-1.73,,1,,6,,7,,1,,118
Corner( 28:32 ),,1316295,,1319567.57,,-3.02,,1,,7,,0,,1,,125
Corner( 29:33 ),,1318370,,1319567.57,,-1.10,,1,,7,,0,,1,,124
Corner( 31:35 ),,1317086,,1319567.57,,-2.29,,1,,8,,0,,1,,124
Corner( 32:36 ),,1319294,,1319567.57,,-0.25,,1,,7,,0,,1,,130
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Split(1-0),,659955,,659783.78,,0.22,,1,,5,,47,,1,,266
Split(2-0),,661104,,659783.78,,1.67,,1,,5,,47,,1,,236
Split(3-0),,660278,,659783.78,,0.63,,1,,6,,28,,1,,291
Split(1-2),,659429,,659783.78,,-0.45,,1,,5,,57,,1,,289
Split(1-4),,658805,,659783.78,,-1.24,,1,,6,,57,,1,,232
Split(2-3),,659752,,659783.78,,-0.04,,1,,6,,28,,1,,304
Split(2-5),,659888,,659783.78,,0.13,,1,,5,,52,,1,,289
Split(3-6),,659116,,659783.78,,-0.85,,1,,5,,8,,1,,249
Split(4-5),,659264,,659783.78,,-0.66,,1,,5,,52,,1,,313
Split(4-7),,659276,,659783.78,,-0.64,,1,,5,,1,,1,,241
Split(5-6),,659252,,659783.78,,-0.67,,1,,5,,8,,1,,245
Split(5-8),,659487,,659783.78,,-0.38,,1,,5,,24,,1,,279
Split(6-9),,660351,,659783.78,,0.72,,1,,5,,4,,1,,282
Split(7-8),,659499,,659783.78,,-0.36,,1,,5,,1,,1,,252
Split(7-10),,658862,,659783.78,,-1.17,,1,,5,,1,,1,,218
Split(8-9),,660586,,659783.78,,1.02,,1,,5,,4,,1,,238
Split(8-11),,660093,,659783.78,,0.39,,1,,6,,24,,1,,309
Split(9-12),,659851,,659783.78,,0.09,,1,,5,,4,,1,,221
Split(10-11),,659456,,659783.78,,-0.41,,1,,5,,26,,1,,239
Split(10-13),,658765,,659783.78,,-1.29,,1,,5,,9,,1,,243
Split(11-12),,659358,,659783.78,,-0.54,,1,,6,,21,,1,,242
Split(11-14),,660783,,659783.78,,1.26,,1,,5,,77,,1,,280
Split(12-15),,658125,,659783.78,,-2.10,,1,,5,,21,,1,,224
Split(13-14),,660092,,659783.78,,0.39,,1,,6,,9,,1,,224
Split(13-16),,659677,,659783.78,,-0.14,,1,,6,,5,,1,,240
Split(14-15),,659550,,659783.78,,-0.30,,1,,6,,35,,1,,246
Split(14-17),,661348,,659783.78,,1.98,,1,,6,,36,,1,,250
Split(15-18),,660072,,659783.78,,0.36,,1,,6,,35,,1,,270
Split(16-17),,660933,,659783.78,,1.45,,1,,5,,5,,1,,236
Split(16-19),,659974,,659783.78,,0.24,,1,,5,,5,,1,,239
Split(17-18),,661870,,659783.78,,2.64,,1,,4,,36,,1,,229
Split(17-20),,661565,,659783.78,,2.25,,1,,5,,31,,1,,246
Split(18-21),,661042,,659783.78,,1.59,,1,,5,,27,,1,,244
Split(19-20),,660606,,659783.78,,1.04,,1,,5,,13,,1,,271
Split(19-22),,660274,,659783.78,,0.62,,1,,5,,13,,1,,236
Split(20-21),,660737,,659783.78,,1.21,,1,,6,,27,,1,,231
Split(20-23),,661230,,659783.78,,1.83,,1,,6,,18,,1,,234
Split(21-24),,660367,,659783.78,,0.74,,1,,5,,10,,1,,230
Split(22-23),,660898,,659783.78,,1.41,,1,,6,,18,,1,,246
Split(22-25),,661076,,659783.78,,1.64,,1,,5,,73,,1,,304
Split(23-24),,660860,,659783.78,,1.36,,1,,6,,10,,1,,265
Split(23-26),,660265,,659783.78,,0.61,,1,,5,,18,,1,,246
Split(24-27),,659634,,659783.78,,-0.19,,1,,5,,7,,1,,266
Split(25-26),,660443,,659783.78,,0.83,,1,,5,,43,,1,,248
Split(25-28),,659492,,659783.78,,-0.37,,1,,6,,96,,1,,254
Split(26-27),,659039,,659783.78,,-0.94,,1,,5,,7,,1,,273
Split(26-29),,659093,,659783.78,,-0.87,,1,,5,,29,,1,,221
Split(27-30),,658602,,659783.78,,-1.50,,1,,6,,7,,1,,285
Split(28-29),,658142,,659783.78,,-2.08,,1,,5,,29,,1,,266
Split(28-31),,658106,,659783.78,,-2.12,,1,,5,,3,,1,,216
Split(29-30),,658656,,659783.78,,-1.43,,1,,6,,29,,1,,223
Split(29-32),,658189,,659783.78,,-2.02,,1,,5,,0,,1,,226
Split(30-33),,660181,,659783.78,,0.50,,1,,5,,2,,1,,254
Split(31-32),,658153,,659783.78,,-2.06,,1,,6,,0,,1,,263
Split(31-34),,659121,,659783.78,,-0.84,,1,,6,,3,,1,,242
Split(32-33),,659714,,659783.78,,-0.09,,1,,5,,0,,1,,247
Split(32-35),,657965,,659783.78,,-2.30,,1,,6,,0,,1,,241
Split(33-36),,661329,,659783.78,,1.96,,1,,5,,2,,1,,241
Split(34-35),,658933,,659783.78,,-1.08,,1,,5,,20,,1,,235
Split(35-36),,659580,,659783.78,,-0.26,,1,,5,,20,,1,,229
[/csv]


[csv=,]
Layout,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
Line(1-0),,1319707,,1154621.62,,161.46,,1,,7,,28,,1,,126
Street(0-2),,990244,,1154621.62,,-160.77,,1,,7,,47,,1,,166
Street(0-3),,990567,,1154621.62,,-160.45,,1,,6,,28,,1,,231
[/csv]


[csv=,]
Sector,,Section,,Spins,,Mean,,Std. Deviation,,Max. Interval,,Max. Repeat,,Spins Last Appeared,,Min. Interval,,Max. Interval
1,,0-26,,660645,,659783.78,,1.09,,1,,5,,43,,1,,238
2,,26-3,,659293,,659783.78,,-0.62,,1,,5,,28,,1,,239
3,,3-35,,658502,,659783.78,,-1.62,,1,,6,,20,,1,,281
4,,35-12,,658192,,659783.78,,-2.01,,1,,5,,20,,1,,283
5,,12-28,,658032,,659783.78,,-2.22,,1,,6,,21,,1,,249
6,,28-7,,658490,,659783.78,,-1.64,,1,,5,,1,,1,,236
7,,7-29,,658874,,659783.78,,-1.15,,1,,5,,1,,1,,226
8,,29-18,,660363,,659783.78,,0.73,,1,,5,,29,,1,,240
9,,18-22,,661563,,659783.78,,2.25,,1,,5,,51,,1,,260
10,,22-9,,661161,,659783.78,,1.74,,1,,5,,4,,1,,234
11,,9-31,,659925,,659783.78,,0.18,,1,,5,,3,,1,,255
12,,31-14,,659805,,659783.78,,0.03,,1,,6,,3,,1,,265
13,,14-20,,661373,,659783.78,,2.01,,1,,5,,31,,1,,247
14,,20-1,,659935,,659783.78,,0.19,,1,,6,,31,,1,,254
15,,1-33,,659928,,659783.78,,0.18,,1,,6,,2,,1,,244
16,,33-16,,660951,,659783.78,,1.48,,1,,5,,2,,1,,235
17,,16-24,,660588,,659783.78,,1.02,,1,,5,,5,,1,,240
18,,24-5,,660024,,659783.78,,0.30,,1,,5,,10,,1,,223
19,,5-10,,658850,,659783.78,,-1.18,,1,,5,,26,,1,,260
20,,10-23,,659686,,659783.78,,-0.12,,1,,6,,18,,1,,290
21,,23-8,,660323,,659783.78,,0.68,,1,,6,,18,,1,,240
22,,8-30,,659281,,659783.78,,-0.64,,1,,6,,24,,1,,227
23,,30-11,,659598,,659783.78,,-0.24,,1,,5,,38,,1,,251
24,,11-36,,660746,,659783.78,,1.22,,1,,5,,22,,1,,247
25,,36-13,,660055,,659783.78,,0.34,,1,,5,,9,,1,,257
26,,13-27,,658723,,659783.78,,-1.34,,1,,5,,7,,1,,244
27,,27-6,,658862,,659783.78,,-1.17,,1,,5,,7,,1,,241
28,,6-34,,659547,,659783.78,,-0.30,,1,,5,,8,,1,,243
29,,34-17,,660664,,659783.78,,1.11,,1,,6,,34,,1,,235
30,,17-25,,661383,,659783.78,,2.02,,1,,5,,36,,1,,241
31,,25-2,,660902,,659783.78,,1.42,,1,,5,,91,,1,,277
32,,2-21,,660231,,659783.78,,0.57,,1,,5,,27,,1,,241
33,,21-4,,659607,,659783.78,,-0.22,,1,,5,,27,,1,,230
34,,4-19,,659476,,659783.78,,-0.39,,1,,5,,13,,1,,273
35,,19-15,,658783,,659783.78,,-1.27,,1,,6,,13,,1,,227
36,,15-32,,657898,,659783.78,,-2.39,,1,,5,,0,,1,,249
37,,32-0,,659741,,659783.78,,-0.05,,1,,5,,0,,1,,268
[/csv]


[csv=,]
No.,,Spins,,Mean,,Std. Deviation,,Measure of Deviation
1,,329140,,329891.89,,-1.33,,1.7137
2,,330289,,329891.89,,0.70,,0.4780
3,,329463,,329891.89,,-0.76,,0.5576
4,,329665,,329891.89,,-0.40,,0.1561
5,,329599,,329891.89,,-0.52,,0.2600
6,,329653,,329891.89,,-0.42,,0.1730
7,,329611,,329891.89,,-0.50,,0.2392
8,,329888,,329891.89,,-0.01,,0.0000
9,,330698,,329891.89,,1.42,,1.9698
10,,329251,,329891.89,,-1.13,,1.2451
11,,330205,,329891.89,,0.55,,0.2972
12,,329153,,329891.89,,-1.30,,1.6550
13,,329514,,329891.89,,-0.67,,0.4329
14,,330578,,329891.89,,1.21,,1.4270
15,,328972,,329891.89,,-1.62,,2.5651
16,,330163,,329891.89,,0.48,,0.2228
17,,330770,,329891.89,,1.55,,2.3374
18,,331100,,329891.89,,2.13,,4.4243
19,,329811,,329891.89,,-0.14,,0.0198
20,,330795,,329891.89,,1.59,,2.4723
21,,329942,,329891.89,,0.09,,0.0076
22,,330463,,329891.89,,1.01,,0.9887
23,,330435,,329891.89,,0.96,,0.8941
24,,330425,,329891.89,,0.94,,0.8615
25,,330613,,329891.89,,1.27,,1.5763
26,,329830,,329891.89,,-0.11,,0.0116
27,,329209,,329891.89,,-1.21,,1.4136
28,,328879,,329891.89,,-1.79,,3.1100
29,,329263,,329891.89,,-1.11,,1.1989
30,,329393,,329891.89,,-0.88,,0.7545
31,,329227,,329891.89,,-1.17,,1.3401
32,,328926,,329891.89,,-1.70,,2.8280
33,,330788,,329891.89,,1.58,,2.4342
34,,329894,,329891.89,,0.00,,0.0000
35,,329039,,329891.89,,-1.51,,2.2050
36,,330541,,329891.89,,1.15,,1.2772
0,,330815,,329891.89,,1.63,,2.5831
[/csv]




Credit to Poit.  :thumbsup:

Vic
#793
Math & Statistics / Re: software
August 03, 2013, 03:07:40 PM
Maestro, kindly say which is the original format of your data?


Are they comma-separated values?
#794
Development / Re: [ALPHA] New Lw tracker
August 03, 2013, 02:29:20 PM
Source code.

Code (Csharp) Select
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LwTrackerR2
{
    public partial class FormTracker : Form
    {
        // History list
        List<int> history = new List<int>();

        // List for holding last two dozens or columns
        List<int> lastTwo = new List<int>();

        // Lw Trackers
        List<string> ld = new List<string>(); // Hit on last two dozens
        List<string> jd = new List<string>(); // Jump from last dozen
        List<string> lc = new List<string>(); // Hit on last two columns
        List<string> jc = new List<string>(); // Jump from last column

        // Set a bigger font for DataGrid rows
        Font BigFont = new System.Drawing.Font(FontFamily.GenericMonospace, 15.75F, System.Drawing.FontStyle.Bold ^ FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

        // Tracker as BindingList of TrackerData (bound to DataGridView)
        BindingList<TrackerData> Tracker = new BindingList<TrackerData>();

        /// <summary>
        /// Constructor
        /// </summary>
        public FormTracker()
        {
            // Initialize
            InitializeComponent();

            // Set icon
            this.Icon = Properties.Resources.roulette_16_to_256;

            // Alternating background
            dgvTracker.RowsDefaultCellStyle.BackColor = Color.White;
            dgvTracker.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGray;

            // Prevent automatic generation of columns
            dgvTracker.AutoGenerateColumns = false;

            // Prevent resize
            dgvTracker.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
            dgvTracker.AllowUserToResizeRows = false;

            // Add Name column
            DataGridViewTextBoxColumn nameColumn = new DataGridViewTextBoxColumn();
            nameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            nameColumn.DataPropertyName = "Name";
            nameColumn.HeaderText = "Name";
            nameColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nameColumn.DefaultCellStyle.Font = BigFont;
            dgvTracker.Columns.Add(nameColumn);

            // Add Advisor column
            DataGridViewTextBoxColumn advisorColumn = new DataGridViewTextBoxColumn();
            advisorColumn.DataPropertyName = "Advisor";
            advisorColumn.HeaderText = "Advisor";
            advisorColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            advisorColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            advisorColumn.DefaultCellStyle.Font = BigFont;
            dgvTracker.Columns.Add(advisorColumn);

            // Add Registry column
            DataGridViewTextBoxColumn registryColumn = new DataGridViewTextBoxColumn();
            registryColumn.DataPropertyName = "Registry";
            registryColumn.HeaderText = "Registry";
            registryColumn.DefaultCellStyle.Font = BigFont;
            registryColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dgvTracker.Columns.Add(registryColumn);

            // Set dgvTracker DataSource
            dgvTracker.DataSource = Tracker;
        }


        /// <summary>
        /// Tracker form's entry point
        /// </summary>
        private void FormTracker_Load(object sender, EventArgs e)
        {
            // Populate tracker's base rows
            Tracker.Add(new TrackerData("LD"));
            Tracker.Add(new TrackerData("JD"));
            Tracker.Add(new TrackerData("LC"));
            Tracker.Add(new TrackerData("JC"));
        }

        /// <summary>
        /// Prevents form closing
        /// </summary>
        private void FormTracker_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Prevent actual closing
            e.Cancel = true;
        }

        /// <summary>
        /// Processes adding a new item to the tracker
        /// </summary>
        /// <param name="n">Number</param>
        public void addNumber(int n)
        {
            // Variable for holding last dozen or column
            int last = 0;

            // Variable for holding beforelast dozen or column
            int beforelast = 0;

            // Variable for holding last addition to registry
            string reg = string.Empty;

            // String for advisors
            string ldAdv = string.Empty;
            string lcAdv = string.Empty;

            // Character arrays for advisors
            char[] jdAdv = null;
            char[] jcAdv = null;

            // Check for zero
            if (n == 0)
            {
                // Add zero to all in the registry
                ld.Add("0");
                jd.Add("0");
                lc.Add("0");
                jc.Add("0");

                /* Let's update all with zero (keeping last advisor) */

                // LD
                Tracker[0].Registry = string.Join("", ld.ToArray());

                // JD
                Tracker[1].Registry = string.Join("", jd.ToArray());

                // LC
                Tracker[2].Registry = string.Join("", lc.ToArray());

                // JC
                Tracker[3].Registry = string.Join("", jc.ToArray());

                // Refresh
                dgvTracker.Refresh();

                // Exit
                return;
            }

            // Insert number into history
            history.Insert(0, n);

            // Check there are at least 2 elements in history
            if (history.Count < 2)
            {
                // Less than two: halt.
                return;
            }

            /* Process LD */

            // Get last dozen
            last = Program.GetDozen(n);

            // Clear list
            lastTwo.Clear();

            // Set LD
            for (int h = 1; h < history.Count; h++)
            {
                // Set dozen for current iteration
                int dozen = Program.GetDozen(history[h]);

                // If dozen is zero...
                if (dozen == 0)
                {
                    // ...jump to next iteration
                    continue;
                }

                // Set beforelast
                if (beforelast == 0 && dozen != last)
                {
                    // Set it!
                    beforelast = dozen;
                }

                // Check for a halt
                if (reg != string.Empty)
                {
                    // Skip iteration
                    continue;
                }

                // Add if it doesn't exist
                if (!lastTwo.Contains(dozen))
                {
                    // Add current one
                    lastTwo.Add(dozen);
                }

                // Check if last dozen is present
                if (lastTwo.Contains(last))
                {
                    // Win
                    reg = "w";

                    // Skip iteration
                    continue;
                }

                // Halt on two elements
                if (lastTwo.Count == 2)
                {
                    // Lose
                    reg = "L";

                    // Halt
                    break;
                }
            }

            // Add hyphen if there's nothing to add
            if (reg.Length == 0)
            {
                // Add hyphen
                reg = "-";
            }

            // Add reg to ld
            ld.Add(reg);

            // Compute advisor
            ldAdv = last.ToString() + (beforelast != 0 ? "," + beforelast.ToString() : "");

            /* Process JD */

            // Reset reg
            reg = string.Empty;

            // Set JD
            for (int h = 1; h < history.Count; h++)
            {
                // Set dozen for current iteration
                int dozen = Program.GetDozen(history[h]);

                // If dozen is zero...
                if (dozen == 0)
                {
                    // ...jump to next iteration
                    continue;
                }

                // Set reg
                if (dozen != last)
                {
                    // Win
                    reg = "w";
                }
                else
                {
                    // Lose
                    reg = "L";
                }

                // Break on addition
                if (reg.Length > 0) { break; }
            }

            // Add hyphen if there's nothing to add
            if (reg.Length == 0)
            {
                // Add hyphen
                reg = "-";
            }

            // Add reg to jd
            jd.Add(reg);

            // Set advisor base
            jdAdv = "123".Replace(last.ToString(), "").ToCharArray();

            /* Process LC */

            // Reset last
            last = 0;

            // Reset beforelast
            beforelast = 0;

            // Reset reg
            reg = string.Empty;

            // Get last column
            last = Program.GetColumn(n);

            // Clear list
            lastTwo.Clear();

            // Set LC
            for (int h = 1; h < history.Count; h++)
            {
                // Set column for current iteration
                int column = Program.GetColumn(history[h]);

                // If column is zero...
                if (column == 0)
                {
                    // ...jump to next iteration
                    continue;
                }

                // Set beforelast
                if (beforelast == 0 && column != last)
                {
                    // Set it!
                    beforelast = column;
                }

                // Check for a halt
                if (reg != string.Empty)
                {
                    // Skip iteration
                    continue;
                }

                // Add if it doesn't exist
                if (!lastTwo.Contains(column))
                {
                    // Add current one
                    lastTwo.Add(column);
                }

                // Check if last column is present
                if (lastTwo.Contains(last))
                {
                    // Win
                    reg = "w";

                    // Skip iteration
                    continue;
                }

                // Halt on two elements
                if (lastTwo.Count == 2)
                {
                    // Lose
                    reg = "L";

                    // Halt
                    break;
                }
            }

            // Add hyphen if there's nothing to add
            if (reg.Length == 0)
            {
                // Add hyphen
                reg = "-";
            }

            // Add reg to lc
            lc.Add(reg);

            // Compute advisor
            lcAdv = last.ToString() + (beforelast != 0 ? "," + beforelast.ToString() : "");

            /* Process JC */

            // Reset reg
            reg = string.Empty;

            // Set JC
            for (int h = 1; h < history.Count; h++)
            {
                // Set column for current iteration
                int column = Program.GetColumn(history[h]);

                // If column is zero...
                if (column == 0)
                {
                    // ...jump to next iteration
                    continue;
                }

                // Set reg
                if (column != last)
                {
                    // Win
                    reg = "w";
                }
                else
                {
                    // Lose
                    reg = "L";
                }

                // Break on addition
                if (reg.Length > 0) { break; }
            }

            // Add hyphen if there's nothing to add
            if (reg.Length == 0)
            {
                // Add hyphen
                reg = "-";
            }

            // Add reg to jc
            jc.Add(reg);

            // Set advisor base
            jcAdv = "123".Replace(last.ToString(), "").ToCharArray();

            // LD
            Tracker[0].Advisor = ldAdv;
            Tracker[0].Registry = string.Join("", ld.ToArray());

            // JD
            Tracker[1].Advisor = jdAdv[0] + "," + jdAdv[1];
            Tracker[1].Registry = string.Join("", jd.ToArray());

            // LC
            Tracker[2].Advisor = lcAdv;
            Tracker[2].Registry = string.Join("", lc.ToArray());

            // JC
            Tracker[3].Advisor = jcAdv[0] + "," + jcAdv[1];
            Tracker[3].Registry = string.Join("", jc.ToArray());

            // Refresh
            dgvTracker.Refresh();
        }

        /// <summary>
        /// Remove number from tracker
        /// </summary>
        public void removeNumber()
        {
            // Declare beforelast
            int beforelast;

            // Let's act according to current history's length
            switch (history.Count)
            {
                // Zero
                case 0:
                    // Exit flat
                    break;

                // One
                case 1:
                    // Clear history
                    history.Clear();

                    /* Clear trackers */

                    ld.Clear();
                    jd.Clear();
                    lc.Clear();
                    jc.Clear();

                    /* Clear datagridiew  */

                    clearDgv();

                    // End case 1
                    break;
                // Two
                case 2:
                    // Save beforelast number
                    beforelast = history[history.Count - 2];

                    // Remove two elements from history
                    history.RemoveRange(history.Count - 2, 2);

                    /* Clear trackers */

                    ld.Clear();
                    jd.Clear();
                    lc.Clear();
                    jc.Clear();

                    /* Clear datagridiew  */

                    clearDgv();

                    // Add saved number
                    addNumber(beforelast);

                    // End case 1
                    break;
                // More
                default:
                    // Save beforelast number
                    beforelast = history[history.Count - 2];

                    // Remove two elements from history
                    history.RemoveRange(history.Count - 2, 2);

                    // Remove two elements from trackers
                    ld.RemoveRange(ld.Count - 2, 2);
                    jd.RemoveRange(jd.Count - 2, 2);
                    lc.RemoveRange(lc.Count - 2, 2);
                    jc.RemoveRange(jc.Count - 2, 2);
                   
                    // Add saved number
                    addNumber(beforelast);

                    // End default
                    break;
            }

            /* Refresh DataGridView */

            // C# Quirk, "can't fall through case 0" can make a good case for an extra check
            dgvTracker.Refresh();
        }
       
        /// <summary>
        /// Clears advisors and registry on dgvTracker
        /// </summary>
        private void clearDgv()
        {
            // LD
            Tracker[0].Advisor = string.Empty;
            Tracker[0].Registry = string.Empty;

            // JD
            Tracker[1].Advisor = string.Empty;
            Tracker[1].Registry = string.Empty;

            // LC
            Tracker[2].Advisor = string.Empty;
            Tracker[2].Registry = string.Empty;

            // JC
            Tracker[3].Advisor = string.Empty;
            Tracker[3].Registry = string.Empty;
        }
    }
}
#795
Development / Re: [ALPHA] New Lw tracker
August 03, 2013, 05:31:41 AM
Thanks Sam,

I'm glad you found no mistakes.

Now we move to ALPHA 2: Undo.

Sponsor download: [attachmini=1]

Please test & report on undo functionality.