/// <summary> /// Change the distance the frame extends into the client area. /// </summary> /// <param name="hWnd">Window handle of form.</param> /// <param name="padding">Distance for each form edge.</param> public static void ExtendFrameIntoClientArea(IntPtr hWnd, Padding padding) { Debug.Assert(hWnd != null); // Cerate structure that contains distances for each edge PI.MARGINS margins = new PI.MARGINS(); margins.leftWidth = padding.Left; margins.topHeight = padding.Top; margins.rightWidth = padding.Right; margins.bottomHeight = padding.Bottom; // Request change from the desktop window manager PI.DwmExtendFrameIntoClientArea(hWnd, ref margins); }