コード例 #1
0
        /// <summary>
        /// Returns the desired quad, if it does not exist, top left is returned
        /// </summary>
        /// <param name="quad"></param>
        /// <returns></returns>
        public static Quadrant GetQuad(int quad)
        {
            string quadText = GetSetting("Quadrants", "Top left,0,0,796,579");

            Quadrant q = new Quadrant();

            if (!quadText.Contains(","))
            {
                q.X      = 0;
                q.Y      = 0;
                q.Width  = 796;
                q.Height = 579;
                q.Name   = "Default - top left";
                q.Number = quad;
            }
            else
            {
                string[] quads    = quadText.Split(';');
                string[] quadData = quads[quad - 1].Split(',');

                q.X      = Convert.ToInt32(quadData[1]);
                q.Y      = Convert.ToInt32(quadData[2]);
                q.Width  = Convert.ToInt32(quadData[3]);
                q.Height = Convert.ToInt32(quadData[4]);
                q.Name   = quadData[0];
                q.Number = quad;
            }

            return(q);
        }
コード例 #2
0
        /// <summary>
        /// Moves the table window to the specific quadrant
        /// </summary>
        /// <param name="quad"></param>
        public void MoveToQuadrant(Quadrant quad, bool activeQuad)
        {
            int x      = quad.X;
            int y      = quad.Y;
            int width  = quad.Width;
            int height = quad.Height;

            // Make sure table ratio & size doesn't exeed quadrant dimenzions
            if (width > MaxTableSize.Width)
            {
                width = MaxTableSize.Width;
            }
            else if (width < MinTableSize.Width)
            {
                width = MinTableSize.Width;
            }

            height = Convert.ToInt32((double)width * GetAspectRatio((int)width, this.Site));

            // Save the previous location
            if (this.Quadrant != Settings.ActiveTableQuadrant)
            {
                Win32.GetWindowRect(handle, ref lastLocation);
            }

            // Move the window
            Win32.SetWindowPos(handle, (int)Win32.HWND.NOTOPMOST, x, y, width, height, (uint)Win32.SWP.NOOWNERZORDER);

            // Force redraw for stars tables
            if (this.GetType() == typeof(StarsTable))
            {
                Win32.SendMessage(Handle, (int)Win32.WM.ENTERSIZEMOVE, 0, 0);
                Win32.SendMessage(Handle, (int)Win32.WM.SIZE, (int)Win32.SIZE.RESTORED, width + height << 16);

                //Rectangle rect = new Rectangle();
                //Win32.GetWindowRect(Handle, ref rect);

                //Win32.SendMessage((IntPtr)Handle, (int)Win32.WM.SIZING, (int)Win32.WMSZ.BOTTOM, ref rect);

                //Win32.SendMessage((IntPtr)Handle, (int)Win32.WM.NCCALCSIZE, false, ref rect);

                Win32.SendMessage(Handle, (int)Win32.WM.EXITSIZEMOVE, 0, 0);
                Win32.SendMessage(Handle, (int)Win32.WM.KILLFOCUS, 0, 0);
            }

            // Set the tables quad location
            Quadrant = quad.Number;
        }
コード例 #3
0
        /// <summary>
        /// Moves the table window to the specific quadrant
        /// </summary>
        /// <param name="quad"></param>
        public void MoveToQuadrant(Quadrant quad, bool activeQuad)
        {
            int x = quad.X;
            int y = quad.Y;
            int width = quad.Width;
            int height = quad.Height;

            // Make sure table ratio & size doesn't exeed quadrant dimenzions
            if (width > MaxTableSize.Width)
                width = MaxTableSize.Width;
            else if (width < MinTableSize.Width)
                width = MinTableSize.Width;

            height = Convert.ToInt32((double)width * GetAspectRatio((int)width, this.Site));

            // Save the previous location
            if(this.Quadrant != Settings.ActiveTableQuadrant)
                Win32.GetWindowRect(handle, ref lastLocation);

            // Move the window
            Win32.SetWindowPos(handle, (int)Win32.HWND.NOTOPMOST, x, y, width, height, (uint)Win32.SWP.NOOWNERZORDER);

            // Force redraw for stars tables
            if (this.GetType() == typeof(StarsTable))
            {
                Win32.SendMessage(Handle, (int)Win32.WM.ENTERSIZEMOVE, 0, 0);
                Win32.SendMessage(Handle, (int)Win32.WM.SIZE, (int)Win32.SIZE.RESTORED, width + height << 16);

                //Rectangle rect = new Rectangle();
                //Win32.GetWindowRect(Handle, ref rect);

                //Win32.SendMessage((IntPtr)Handle, (int)Win32.WM.SIZING, (int)Win32.WMSZ.BOTTOM, ref rect);

                //Win32.SendMessage((IntPtr)Handle, (int)Win32.WM.NCCALCSIZE, false, ref rect);

                Win32.SendMessage(Handle, (int)Win32.WM.EXITSIZEMOVE, 0, 0);
                Win32.SendMessage(Handle, (int)Win32.WM.KILLFOCUS, 0, 0);
            }

            // Set the tables quad location
            Quadrant = quad.Number;
        }
コード例 #4
0
        /// <summary>
        /// Returns the desired quad, if it does not exist, top left is returned
        /// </summary>
        /// <param name="quad"></param>
        /// <returns></returns>
        public static Quadrant GetQuad(int quad)
        {
            string quadText = GetSetting("Quadrants", "Top left,0,0,796,579");

            Quadrant q = new Quadrant();

            if (!quadText.Contains(","))
            {
                q.X = 0;
                q.Y = 0;
                q.Width = 796;
                q.Height = 579;
                q.Name = "Default - top left";
                q.Number = quad;
            }
            else
            {
                string[] quads = quadText.Split(';');
                string[] quadData = quads[quad - 1].Split(',');

                q.X = Convert.ToInt32(quadData[1]);
                q.Y = Convert.ToInt32(quadData[2]);
                q.Width = Convert.ToInt32(quadData[3]);
                q.Height = Convert.ToInt32(quadData[4]);
                q.Name = quadData[0];
                q.Number = quad;
            }

            return q;
        }