.NET remove MdiClient Border without using PInvoke methods (.NET native way)
<p>My form is a MdiContainer where i load child forms into.</p>

<p>It looks like this:</p>

<p><a href="https://i.stack.imgur.com/tMW7f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tMW7f.png" alt="enter image description here"></a></p>

<p>As you can see there is this 3d-style border around the MdiClient.</p>

<p>By using the following method we can remove this effect and also color the area:</p>

<pre><code>[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

private const int GWL_EXSTYLE = -20;
private const int WS_EX_CLIENTEDGE = 0x200;

private void button1_Click(object sender, EventArgs e)
{
    foreach (var mdi in this.Controls.OfType&lt;MdiClient&gt;())
    {
        mdi.BackColor = Color.AntiqueWhite;
        mdi.Dock = DockStyle.None;
        int window = GetWindowLong(mdi.Handle, GWL_EXSTYLE);
        window &amp;= ~WS_EX_CLIENTEDGE;
        SetWindowLong(mdi.Handle, GWL_EXSTYLE, window);
        mdi.Dock = DockStyle.Fill;
    }
}
</code></pre>

<p>So it looks like this:</p>

<p><a href="https://i.stack.imgur.com/10iBs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/10iBs.png" alt="enter image description here"></a></p>

<p>I am wondering if there is a way to accomplish the same result without using the Win32 PInvoke methods and use native .NET methods?</p>