예제 #1
0
        private void OnWMGetMinMaxInfo(ref Message m)
        {
            Telerik.WinControls.NativeMethods.MINMAXINFO structure = (Telerik.WinControls.NativeMethods.MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(Telerik.WinControls.NativeMethods.MINMAXINFO));
            if (this.Form.IsMdiChild)
            {
                structure.ptMaxTrackSize.x = Math.Max(structure.ptMaxTrackSize.x, structure.ptMaxSize.x);
            }
            else if (!this.Form.IsMdiChild && this.IsMaximized && !DWMAPI.IsCompositionEnabled)
            {
                structure.ptMaxTrackSize.y = this.GetMaximumFormHeightAccordingToCurrentScreen();
                if (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1)
                {
                    Screen screen = Screen.FromControl((Control)this.Form);
                    if (screen != null)
                    {
                        structure.ptMaxPosition.y = screen.WorkingArea.Y - SystemInformation.FrameBorderSize.Height;
                    }
                }
            }
            structure.ptMinTrackSize.x = SystemInformation.MinimumWindowSize.Width;
            structure.ptMinTrackSize.y = this.ClientMargin.Vertical;
            MinMaxInfo minMaxInfo = new MinMaxInfo();

            minMaxInfo.MaxPosition  = new Point(structure.ptMaxPosition.x, structure.ptMaxPosition.y);
            minMaxInfo.MaxTrackSize = new Size(structure.ptMaxTrackSize.x, structure.ptMaxTrackSize.y);
            minMaxInfo.MinTrackSize = new Size(structure.ptMinTrackSize.x, structure.ptMinTrackSize.y);
            minMaxInfo.MaxSize      = new Size(structure.ptMaxSize.x, structure.ptMaxSize.y);
            minMaxInfo.SizeReserved = new Size(structure.ptReserved.x, structure.ptReserved.y);
            this.OnGetMinMaxInfo(minMaxInfo);
            structure.ptMaxPosition.x  = minMaxInfo.MaxPosition.X;
            structure.ptMaxPosition.y  = minMaxInfo.MaxPosition.Y;
            structure.ptMaxTrackSize.x = minMaxInfo.MaxTrackSize.Width;
            structure.ptMaxTrackSize.y = minMaxInfo.MaxTrackSize.Height;
            structure.ptMinTrackSize.x = minMaxInfo.MinTrackSize.Width;
            structure.ptMinTrackSize.y = minMaxInfo.MinTrackSize.Height;
            structure.ptMaxSize.x      = minMaxInfo.MaxSize.Width;
            structure.ptMaxSize.y      = minMaxInfo.MaxSize.Height;
            structure.ptReserved.x     = minMaxInfo.SizeReserved.Width;
            structure.ptReserved.y     = minMaxInfo.SizeReserved.Height;
            Marshal.StructureToPtr((object)structure, m.LParam, true);
            this.CallBaseWndProc(ref m);
        }
예제 #2
0
        protected override void OnGetMinMaxInfo(MinMaxInfo minMaxInfo)
        {
            minMaxInfo.MinTrackSize = new Size(SystemInformation.MinimizedWindowSize.Width, 100);

            base.OnGetMinMaxInfo(minMaxInfo);
        }
예제 #3
0
 /// <summary>
 /// This event is fired when the WM_GETMINMAXINFO message is sent to the form.
 /// </summary>
 /// <param name="minMaxInfo">Contains information about the position, maximum/minimum size of the form etc.
 /// Can be modified to adjust the settings applied to the form.</param>
 protected virtual void OnGetMinMaxInfo(MinMaxInfo minMaxInfo)
 {
 }