Пример #1
0
 public void Clear()
 {
     hwndMain = IntPtr.Zero;
     hwndAudioBTN = IntPtr.Zero;
     hwndVideoBTN = IntPtr.Zero;
     hwndStatusBar = IntPtr.Zero;
     hwndSnapshotBTN = IntPtr.Zero;
     hwndMaximiseBTN = IntPtr.Zero;
     hwndPromoteBTN = IntPtr.Zero;
     DisplayName = "";
     Location = "";
     isUser = false;
     isInPosition = false;
     Position = 0;
     Border = new RECT();
     wantedBorder = new RECT();
 }
Пример #2
0
        /*
        public static Int32 sm_width = (scr_width - 2 * border) / 6;
        public static Int32 sm_height = 3 * (sm_width) / 4 + voffset;
        public static Int32 lg_height = (scr_height - 2 * border - sm_height - vgap);
        public static Int32 lg_width = 4 * (lg_height) / 3 - hoffset;
        */
        //public static Boolean promote = false;

        public static RECT getRECT(int window, int numberofparticipants)
        {
            Int32 scr_width = Data.constants.WIDTH;
            Int32 scr_height = Data.constants.HEIGHT;
            Boolean wscreen = Data.constants.isWidescreen;
            RECT newRect = new RECT();
            /*
            if (wscreen)
            {
                hgap = scr_width / 35;
                //vgap = hgap;
                vgap = 0;
                if (numberofparticipants == 3 || numberofparticipants == 4 || numberofparticipants == 9)
                { hgap = 5 * hgap; }
                if (numberofparticipants == 9)
                { vgap = scr_height / 60; }
            }
            */
            if (Data.constants.isPromoting && Data.constants.toPromote != 0 && numberofparticipants > 1)
            {
                switch (numberofparticipants % 2)
                {
                    case 0:
                        hoffset2 = sm_width / 2;
                        break;

                    case 1:
                        hoffset2 = 0;
                        break;
                }

                if (numberofparticipants > 6)
                {
                    prom_hdiv = numberofparticipants - 1;
                }

                sm_width = (scr_width - 2 * border) / prom_hdiv;
                sm_height = 3 * (sm_width) / 4 + voffset;
                lg_height = (scr_height - 2 * border - sm_height - vgap);
                lg_width = 4 * (lg_height) / 3 - hoffset;

                switch (window)
                {
                    case 1:
                        newRect.Top = border;
                        newRect.Bottom = border + lg_height;
                        newRect.Left = (scr_width - lg_width) / 2;
                        newRect.Right = (scr_width + lg_width) / 2;
                        break;

                    case 2:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Right = scr_width / 2 + hoffset2;
                        newRect.Left = newRect.Right - sm_width;
                        break;

                    case 3:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Left = scr_width / 2 + hoffset2;
                        newRect.Right = newRect.Left + sm_width;
                        break;

                    case 4:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Right = scr_width / 2 - sm_width + hoffset2;
                        newRect.Left = newRect.Right - sm_width;
                        break;

                    case 5:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Left = scr_width / 2 + sm_width + hoffset2;
                        newRect.Right = newRect.Left + sm_width;
                        break;

                    case 6:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Right = scr_width / 2 - 2 * sm_width + hoffset2;
                        newRect.Left = newRect.Right - sm_width;
                        break;

                    case 7:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Left = scr_width / 2 + 2 * sm_width + hoffset2;
                        newRect.Right = newRect.Left + sm_width;
                        break;

                    case 8:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Right = scr_width / 2 - 3 * sm_width + hoffset2;
                        newRect.Left = newRect.Right - sm_width;
                        break;

                    case 9:
                        newRect.Bottom = (scr_height - border);
                        newRect.Top = newRect.Bottom - sm_height;
                        newRect.Left = scr_width / 2 + 3 * sm_width;
                        newRect.Right = newRect.Left + sm_width;
                        break;
                }
            }

            else
            {
                switch (numberofparticipants)
                {

                    #region 1
                    case 1:
                        newRect.Top = border;
                        newRect.Bottom = scr_height - border;
                        newRect.Right = (scr_width / 2 + (2 * (newRect.Bottom - newRect.Top) / 3) - hoffset / 2);
                        newRect.Left = (scr_width / 2 - (2 * (newRect.Bottom - newRect.Top) / 3) + hoffset / 2);
                        break;
                    #endregion

                    #region 2
                    case 2:

                        switch (window)
                        {

                            case 1:
                                newRect.Left = border;
                                newRect.Right = (scr_width - hgap) / 2;
                                newRect.Top = (scr_height - (3 * (newRect.Right - newRect.Left) / 4) - voffset) / 2;
                                newRect.Bottom = (scr_height + (3 * (newRect.Right - newRect.Left) / 4) + voffset) / 2;
                                break;

                            case 2:
                                newRect.Left = (scr_width + hgap) / 2;
                                newRect.Right = (scr_width - border);
                                newRect.Top = (scr_height - (3 * (newRect.Right - newRect.Left) / 4) - voffset) / 2;
                                newRect.Bottom = (scr_height + (3 * (newRect.Right - newRect.Left) / 4) + voffset) / 2;
                                break;
                        }
                        break;
                    #endregion

                    #region 3
                    case 3:

                        switch (window)
                        {
                            case 1:
                                newRect.Top = border;
                                newRect.Bottom = (scr_height - vgap) / 2;
                                newRect.Left = ((scr_width - hgap) / 2) - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset;
                                newRect.Right = (scr_width - hgap) / 2;
                                break;

                            case 2:
                                newRect.Top = border;
                                newRect.Bottom = (scr_height - vgap) / 2;
                                newRect.Right = ((scr_width + hgap) / 2) + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset;
                                newRect.Left = (scr_width + hgap) / 2;
                                break;

                            case 3:
                                newRect.Top = (scr_height + vgap) / 2;
                                newRect.Bottom = (scr_height - border);
                                newRect.Right = (scr_width / 2 + (2 * (newRect.Bottom - newRect.Top) / 3) - hoffset / 2);
                                newRect.Left = (scr_width / 2 - (2 * (newRect.Bottom - newRect.Top) / 3) + hoffset / 2);
                                break;
                        }
                        break;
                    #endregion

                    #region 4
                    case 4:

                        switch (window)
                        {

                            case 1:
                                newRect.Top = border;
                                newRect.Bottom = (scr_height - vgap) / 2;
                                newRect.Left = ((scr_width - hgap) / 2) - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset;
                                newRect.Right = (scr_width - hgap) / 2;
                                break;

                            case 2:
                                newRect.Top = border;
                                newRect.Bottom = (scr_height - vgap) / 2;
                                newRect.Right = ((scr_width + hgap) / 2) + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset;
                                newRect.Left = (scr_width + hgap) / 2;
                                break;

                            case 3:
                                newRect.Top = (scr_height + vgap) / 2;
                                newRect.Bottom = (scr_height - border);
                                newRect.Left = ((scr_width - hgap) / 2) - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset;
                                newRect.Right = (scr_width - hgap) / 2;
                                break;

                            case 4:
                                newRect.Top = (scr_height + vgap) / 2;
                                newRect.Bottom = (scr_height - border);
                                newRect.Right = ((scr_width + hgap) / 2) + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset;
                                newRect.Left = (scr_width + hgap) / 2;
                                break;
                        }
                        break;
                    #endregion

                    #region 5
                    case 5:

                        switch (window)
                        {

                            case 1:
                                newRect.Left = border;
                                newRect.Right = ((scr_width - 2 * (border + hgap)) / 3 + border);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 2:
                                newRect.Left = (border + hgap) + (scr_width - 2 * (border + hgap)) / 3;
                                newRect.Right = scr_width - ((border + hgap) + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 3:
                                newRect.Left = scr_width - (border + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Right = (scr_width - border);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 4:
                                newRect.Left = (scr_width - hgap) / 2 - (scr_width - 2 * (border + hgap)) / 3;
                                newRect.Right = (scr_width - hgap) / 2;
                                newRect.Top = ((scr_height + vgap) / 2);
                                newRect.Bottom = newRect.Top + (3 * (newRect.Right - newRect.Left) / 4) + voffset;
                                break;

                            case 5:
                                newRect.Left = (scr_width + hgap) / 2;
                                newRect.Right = (scr_width + hgap) / 2 + (scr_width - 2 * (border + hgap)) / 3;
                                newRect.Top = ((scr_height + vgap) / 2);
                                newRect.Bottom = newRect.Top + (3 * (newRect.Right - newRect.Left) / 4) + voffset;
                                break;
                        }
                        break;
                    #endregion

                    #region 6
                    case 6:

                        switch (window)
                        {

                            case 1:
                                newRect.Left = border;
                                newRect.Right = ((scr_width - 2 * (border + hgap)) / 3 + border);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 2:
                                newRect.Left = (border + hgap) + (scr_width - 2 * (border + hgap)) / 3;
                                newRect.Right = scr_width - ((border + hgap) + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 3:
                                newRect.Left = scr_width - (border + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Right = (scr_width - border);
                                newRect.Top = ((scr_height - vgap) / 2) - (3 * (newRect.Right - newRect.Left) / 4) - voffset;
                                newRect.Bottom = ((scr_height - vgap) / 2);
                                break;

                            case 4:
                                newRect.Left = border;
                                newRect.Right = ((scr_width - 2 * (border + hgap)) / 3 + border);
                                newRect.Top = ((scr_height + vgap) / 2);
                                newRect.Bottom = newRect.Top + (3 * (newRect.Right - newRect.Left) / 4) + voffset;
                                break;

                            case 5:
                                newRect.Left = (border + hgap) + (scr_width - 2 * (border + hgap)) / 3;
                                newRect.Right = scr_width - ((border + hgap) + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Top = ((scr_height + vgap) / 2);
                                newRect.Bottom = newRect.Top + (3 * (newRect.Right - newRect.Left) / 4) + voffset;
                                break;

                            case 6:
                                newRect.Left = scr_width - (border + (scr_width - 2 * (border + hgap)) / 3);
                                newRect.Right = (scr_width - border);
                                newRect.Top = ((scr_height + vgap) / 2);
                                newRect.Bottom = newRect.Top + (3 * (newRect.Right - newRect.Left) / 4) + voffset;
                                break;
                        }
                        break;
                    #endregion

                    #region 7
                    case 7:

                        if (wscreen)
                        {
                            switch (window)
                            {
                                case 1:
                                    newRect.Left = border;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + border;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 2:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + border;
                                    newRect.Right = (scr_width - hgap) / 2;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 3:
                                    newRect.Left = (scr_width + hgap) / 2;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + newRect.Left;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 4:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2;
                                    newRect.Right = scr_width - border;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 5:
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    newRect.Left = (scr_width / 2) - 2 * (newRect.Bottom - newRect.Top - voffset) - hgap;
                                    newRect.Right = (scr_width / 2) - 2 * (newRect.Bottom - newRect.Top - voffset) / 3 - hgap;
                                    break;

                                case 6:
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    newRect.Left = (scr_width / 2) - 2 * (newRect.Bottom - newRect.Top - voffset) / 3;
                                    newRect.Right = (scr_width / 2) + 2 * (newRect.Bottom - newRect.Top - voffset) / 3;
                                    break;

                                case 7:
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    newRect.Left = (scr_width / 2) + 2 * (newRect.Bottom - newRect.Top - voffset) / 3 + hgap;
                                    newRect.Right = (scr_width / 2) + 2 * (newRect.Bottom - newRect.Top - voffset) + hgap;
                                    break;
                            }
                        }
                        else
                        {
                            switch (window)
                            {

                                case 1:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                    newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                    break;

                                case 2:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                    newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                    break;

                                case 3:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                    newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                    break;

                                case 4:
                                    newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                    newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                    newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                    break;

                                case 5:
                                    newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                    newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                    newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                    break;

                                case 6:
                                    newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                    newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                    newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                    break;

                                case 7:
                                    newRect.Top = (2 * (scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = scr_height - border;
                                    newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                    newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                    break;
                            }
                        }
                        break;
                    #endregion

                    #region 8
                    case 8:

                        if (wscreen)
                        {
                            switch (window)
                            {
                                case 1:
                                    newRect.Left = border;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + border;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 2:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + border;
                                    newRect.Right = (scr_width - hgap) / 2;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 3:
                                    newRect.Left = (scr_width + hgap) / 2;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + newRect.Left;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 4:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2;
                                    newRect.Right = scr_width - border;
                                    newRect.Bottom = (scr_height - vgap) / 2;
                                    newRect.Top = newRect.Bottom - 3 * (newRect.Right - newRect.Left) / 4 - voffset;
                                    break;

                                case 5:
                                    newRect.Left = border;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + border;
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    break;

                                case 6:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + border;
                                    newRect.Right = (scr_width - hgap) / 2;
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    break;

                                case 7:
                                    newRect.Left = (scr_width + hgap) / 2;
                                    newRect.Right = (scr_width / 2 - hgap / 2 - border) / 2 - hgap / 2 + newRect.Left;
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    break;

                                case 8:
                                    newRect.Left = (scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2;
                                    newRect.Right = scr_width - border;
                                    newRect.Top = (scr_height + vgap) / 2;
                                    newRect.Bottom = newRect.Top + 3 * ((scr_width - border) - ((scr_width / 2 - hgap / 2 - border) / 2 + hgap / 2 + (scr_width + hgap) / 2)) / 4 + voffset;
                                    break;
                            }
                        }
                        else
                        {
                            switch (window)
                            {

                                case 1:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                    newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                    break;

                                case 2:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                    newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                    break;

                                case 3:
                                    newRect.Top = border + vgap / 2;
                                    newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                    newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                    break;

                                case 4:
                                    newRect.Top = (border + (scr_height - 2 * border) / 3) + (vgap / 2);
                                    newRect.Bottom = (border + 2 * (scr_height - 2 * border) / 3) - (vgap / 2);
                                    newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                    newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                    break;

                                case 5:
                                    newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                    newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                    newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                    break;

                                case 6:
                                    newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                    newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                    newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                    newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                    break;

                                case 7:
                                    newRect.Top = (scr_height) - (((scr_height - 2 * (border)) / 3) - (vgap / 2) + border);
                                    newRect.Bottom = (scr_height - border - vgap / 2);
                                    newRect.Left = (scr_width - hgap) / 2 - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset;
                                    newRect.Right = (scr_width - hgap) / 2;
                                    break;

                                case 8:
                                    newRect.Top = (scr_height) - (((scr_height - 2 * (border)) / 3) - (vgap / 2) + border);
                                    newRect.Bottom = (scr_height - border - vgap / 2);
                                    newRect.Left = (scr_width + hgap) / 2;
                                    newRect.Right = (scr_width - hgap) / 2 + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset;
                                    break;
                            }
                        }
                        break;
                    #endregion

                    #region 9
                    case 9:

                        switch (window)
                        {

                            case 1:
                                newRect.Top = border + vgap / 2;
                                newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                break;

                            case 2:
                                newRect.Top = border + vgap / 2;
                                newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                break;

                            case 3:
                                newRect.Top = border + vgap / 2;
                                newRect.Bottom = (border + (scr_height - 2 * border) / 3) - (vgap / 2);
                                newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                break;

                            case 4:
                                newRect.Top = (border + (scr_height - 2 * border) / 3) + (vgap / 2);
                                newRect.Bottom = (border + 2 * (scr_height - 2 * border) / 3) - (vgap / 2);
                                newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                break;

                            case 5:
                                newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                break;

                            case 6:
                                newRect.Top = ((scr_height - 2 * (border)) / 3) + (vgap / 2) + border;
                                newRect.Bottom = (2 * (scr_height - 2 * (border)) / 3) - (vgap / 2) + border;
                                newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                break;

                            case 7:
                                newRect.Top = (scr_height) - (((scr_height - 2 * (border)) / 3) - (vgap / 2) + border);
                                newRect.Bottom = (scr_height - border - vgap / 2);
                                newRect.Left = ((scr_width - (12 * (newRect.Bottom - newRect.Top) / 3) + 3 * hoffset) / 2) - hgap;
                                newRect.Right = ((scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2) - hgap;
                                break;

                            case 8:
                                newRect.Top = (scr_height) - (((scr_height - 2 * (border)) / 3) - (vgap / 2) + border);
                                newRect.Bottom = (scr_height - border - vgap / 2);
                                newRect.Left = (scr_width - (4 * (newRect.Bottom - newRect.Top) / 3) + hoffset) / 2;
                                newRect.Right = (scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2;
                                break;

                            case 9:
                                newRect.Top = (scr_height) - (((scr_height - 2 * (border)) / 3) - (vgap / 2) + border);
                                newRect.Bottom = (scr_height - border - vgap / 2);
                                newRect.Left = ((scr_width + (4 * (newRect.Bottom - newRect.Top) / 3) - hoffset) / 2) + hgap;
                                newRect.Right = ((scr_width + (12 * (newRect.Bottom - newRect.Top) / 3) - 3 * hoffset) / 2) + hgap;
                                break;
                        }
                        break;
                    #endregion
                }
            }
            return newRect;
        }
Пример #3
0
 public static void apiSetWindowTop(IntPtr hwnd, RECT rect)
 {
     /*
     uint FLAGS = SWP_NOACTIVATE;
     if (rect.Bottom==0 && rect.Left==0 && rect.Right==0 && rect.Top==0)
     {
         // means we don't want to move the window, just bring it to the front
         FLAGS |= SWP_NOMOVE | SWP_NOSIZE;
     }
       * */
     SetForegroundWindow(hwnd);
     SetWindowPos(hwnd, HWND_TOPMOST, rect.Left, rect.Top, rect.Width, rect.Height, SWP_NOACTIVATE);
     
 }
Пример #4
0
 public static RECT apiGetRect(IntPtr hwnd) 
 {
     RECT fail = new RECT();
     GetWindowRect(hwnd, ref fail);
     return fail;
 }
Пример #5
0
 private static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);