public static extern IntPtr DeferWindowPos(IntPtr hDefer, IntPtr hWnd, IntPtr hWndInsertAfter, int left, int top, int width, int height, MoveWindowFlags flags);
public static extern void SetWindowPos(IntPtr hWnd, IntPtr hWndNewParent, int left, int top, int width, int height, MoveWindowFlags flags);
public void AddControl(Control windowToMove, Control windowToInsertZOrderAfter, Rect frame, MoveWindowFlags flags = 0) { Handle = NativeMethods.DeferWindowPos(Handle, windowToMove.Handle, windowToInsertZOrderAfter.Handle, frame.left, frame.top, frame.Width, frame.Height, flags); }
public void AddControl(Control windowToMove, ZOrderPosition specialZOrderPosition, Rect frame, MoveWindowFlags flags = 0) { IntPtr hWndSpecial; switch (specialZOrderPosition) { case ZOrderPosition.Top: hWndSpecial = HWND_TOP; break; case ZOrderPosition.Bottom: hWndSpecial = HWND_BOTTOM; break; case ZOrderPosition.Topmost: hWndSpecial = HWND_TOPMOST; break; case ZOrderPosition.AboveNonTopmost: hWndSpecial = HWND_NOTOPMOST; break; default: throw new ArgumentException("Invalid ZOrderPosition value", nameof(specialZOrderPosition)); } Handle = NativeMethods.DeferWindowPos(Handle, windowToMove.Handle, hWndSpecial, frame.left, frame.top, frame.Width, frame.Height, flags); }
public void AddControl(Control windowToMove, Rect frame, MoveWindowFlags flags = 0) { Handle = NativeMethods.DeferWindowPos(Handle, windowToMove.Handle, IntPtr.Zero, frame.left, frame.top, frame.Width, frame.Height, flags | MoveWindowFlags.IgnoreZOrder); }