private void RecalculateControlBounds(Window window) { Internal.Windows.Structures.User32.RECT rect1 = new Internal.Windows.Structures.User32.RECT(); Internal.Windows.Methods.User32.GetWindowRect(handlesByControl[window], ref rect1); window.Bounds = PhysicalBoundsToClientBounds(RECTToRectangle(rect1)); window.Layout.ResetControlBounds(); foreach (Control ctl in window.Controls) { if (GetProperty<bool>("Windowless")) { } else { IntPtr hWnd = handlesByControl[ctl]; Rectangle rect = window.Layout.GetControlBounds(ctl); Internal.Windows.Methods.User32.SetWindowPos(hWnd, IntPtr.Zero, (int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height, 0); } } }
protected override Monitor[] GetMonitorsInternal() { if (_monitorList != null) throw new InvalidOperationException("Already in use"); _monitorList = new List<Monitor>(); Internal.Windows.Structures.User32.RECT rect = new Internal.Windows.Structures.User32.RECT(-32000, -32000, 64000, 64000); bool retval = Internal.Windows.Methods.User32.EnumDisplayMonitors(IntPtr.Zero, ref rect, GetMonitorsInternalCallback, IntPtr.Zero); Monitor[] items = _monitorList.ToArray(); _monitorList = null; return items; }