Beispiel #1
0
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            base.SetBoundsCore(x, y, width, height, specified);

            // Defect# 115626: when we attempt to set dimensions of form to be more than desktop bounds (resolution), winforms does not set this size.
            // It sets max size of window to be dimension + 12 pixels. This is what that happens. This can even be reproduced with dual monitor when dimension is increased accordingly.
            // Some links:
            // https://msdn.microsoft.com/en-us/library/25w4thew(v=vs.110).aspx
            // http://bytes.com/topic/c-sharp/answers/252405-increase-maximum-size-windows-form-designer
            // http://www.codeproject.com/Questions/273139/I-need-to-increase-max-size-length-in-my-windows-F
            // Below mentioned link has suggestion which fixes the problem. The call to MoveWindow when bounds are set, helps.
            // http://stackoverflow.com/questions/6651115/is-the-size-of-a-form-in-visual-studio-designer-limited-to-screen-resolution
            // Restrict this fix to Child window since we have problem for it for now.

            if (Parent != null && (width > SystemInformation.MaxWindowTrackSize.Width || height > SystemInformation.MaxWindowTrackSize.Height))
            {
                NativeWindowCommon.MoveWindow(Handle, x, y, width, height, true);
            }
        }