Example #1
0
        public static void SetFormPosition(Form frm, int altLocationX = -1, int altLocationY = -1,
                                           bool useDefaultLocation    = true)
        {
            Point adjustedPoint = new Point(altLocationX, altLocationY);

            frm.StartPosition = FormStartPosition.Manual;
            if (useDefaultLocation)
            {
                GV.ScreenList = Screens.GetScreenInfo();
                int Monitor    = GV.ActiveScreen;
                int numScreens = GV.ScreenList.Count;
                if (Monitor > numScreens)
                {
                    Monitor         = 1;
                    GV.ActiveScreen = 1;
                }
                ScreenModel model = GV.ScreenList[Monitor - 1];
                frm.Location = new Point(model.Xpos, model.Ypos);
            }
            else
            {
                frm.Location = new Point(altLocationX, altLocationY);
            }
        }