private unsafe void OnGetMinMaxInfo(IntPtr hwnd, IntPtr lParam) { WinApi.MINMAXINFO *pmmi = (WinApi.MINMAXINFO *)lParam; // NOTE: MaxPosition is always relative to the origin of the window's current screen // e.g. usually (0, 0) unless the taskbar is on the left or top. Screen s = Screen.FromHandle(hwnd); pmmi->MaxSize = s.WorkingArea.Size; pmmi->MaxPosition.X = Math.Abs(s.WorkingArea.Left - s.Bounds.Left); pmmi->MaxPosition.Y = Math.Abs(s.WorkingArea.Top - s.Bounds.Top); // The form seems to fill these in just fine... //if (MinimumSize.Width > 0) pmmi->MinTrackSize.x = MinimumSize.Width; //if (MinimumSize.Height > 0) pmmi->MinTrackSize.y = MinimumSize.Height; //if (MaximumSize.Width > 0) pmmi->MaxTrackSize.x = MaximumSize.Width; //if (MaximumSize.Height > 0) pmmi->MaxTrackSize.y = MaximumSize.Height; // I guess these should have the normal window frame dimensions added to be correct // see SystemInformation.XXX _minTrackSize.Width = Math.Max(_minTrackSize.Width, pmmi->MinTrackSize.Width); _minTrackSize.Height = Math.Max(_minTrackSize.Height, pmmi->MinTrackSize.Height); _minTrackSize = SizeFromClientSize(_minTrackSize); }
private unsafe void OnGetMinMaxInfo(IntPtr hwnd, IntPtr lParam) { WinApi.MINMAXINFO *pmmi = (WinApi.MINMAXINFO *)lParam; //YOROCA MDI PARENT Screen s = Screen.FromHandle(hwnd); //if (IsMdiChild) if (this.Parent != null) { pmmi->ptMaxSize.x = this.Parent.ClientRectangle.Size.Width; pmmi->ptMaxSize.y = this.Parent.ClientRectangle.Size.Height; } else { pmmi->ptMaxSize.x = s.WorkingArea.Width; pmmi->ptMaxSize.y = s.WorkingArea.Height; } pmmi->ptMaxPosition.x = Math.Abs(s.WorkingArea.Left - s.Bounds.Left); pmmi->ptMaxPosition.y = Math.Abs(s.WorkingArea.Top - s.Bounds.Top); //if (MinimumSize.Width > 0) pmmi->ptMinTrackSize.x = MinimumSize.Width; //if (MinimumSize.Height > 0) pmmi->ptMinTrackSize.y = MinimumSize.Height; //if (MaximumSize.Width > 0) pmmi->ptMaxTrackSize.x = MaximumSize.Width; //if (MaximumSize.Height > 0) pmmi->ptMaxTrackSize.y = MaximumSize.Height; }
private unsafe void OnGetMinMaxInfo(IntPtr hwnd, IntPtr lParam) { WinApi.MINMAXINFO *ptr = (WinApi.MINMAXINFO *)((void *)lParam); Screen screen = Screen.FromHandle(hwnd); ptr->ptMaxSize.X = screen.WorkingArea.Width; ptr->ptMaxSize.Y = screen.WorkingArea.Height; ptr->ptMaxPosition.X = Math.Abs(screen.WorkingArea.Left - screen.Bounds.Left); ptr->ptMaxPosition.Y = Math.Abs(screen.WorkingArea.Top - screen.Bounds.Top); }
private unsafe void OnGetMinMaxInfo(IntPtr hwnd, IntPtr lParam) { WinApi.MINMAXINFO *pmmi = (WinApi.MINMAXINFO *)lParam; Screen s = Screen.FromHandle(hwnd); pmmi->ptMaxSize.x = s.WorkingArea.Width; pmmi->ptMaxSize.y = s.WorkingArea.Height; pmmi->ptMaxPosition.x = Math.Abs(s.WorkingArea.Left - s.Bounds.Left); pmmi->ptMaxPosition.y = Math.Abs(s.WorkingArea.Top - s.Bounds.Top); //if (MinimumSize.Width > 0) pmmi->ptMinTrackSize.x = MinimumSize.Width; //if (MinimumSize.Height > 0) pmmi->ptMinTrackSize.y = MinimumSize.Height; //if (MaximumSize.Width > 0) pmmi->ptMaxTrackSize.x = MaximumSize.Width; //if (MaximumSize.Height > 0) pmmi->ptMaxTrackSize.y = MaximumSize.Height; }