Example #1
0
        private void PositionWindow(SuperGridControl superGrid)
        {
            if (_size != Size.Empty)
                Size = _size;

            Form form = superGrid.FindForm();

            if (form != null)
            {
                Point pt = form.Location;

                if (_offset != Point.Empty)
                {
                    pt.Offset(_offset);

                    Location = pt;
                }
                else
                {
                    Screen screen = Screen.FromControl(form);

                    int boundWidth = screen.Bounds.Width;
                    int boundHeight = screen.Bounds.Height;

                    int x = boundWidth - Width;
                    int y = boundHeight - Height;

                    Location = new Point(screen.Bounds.X + x / 2, screen.Bounds.Y + y / 2);
                }
            }

            _LockedResize = false;
        }