C#:玻璃表格?

Bri*_*ham 11 c# windows themes aero winforms

如何使用航空玻璃覆盖整个表格?这是我的意思的一个例子:

在此输入图像描述

小智 12

[StructLayout(LayoutKind.Sequential)]
public struct MARGINS
{
    public int Left;
    public int Right;
    public int Top;
    public int Bottom;
}

[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
Run Code Online (Sandbox Code Playgroud)

然后您可以在表单上启用它,如下所示:

MARGINS marg = new MARGINS() { Left = -1, Right = -1, Top = -1, Bottom = -1 };
DwmExtendFrameIntoClientArea(form.Handle, marg);
Run Code Online (Sandbox Code Playgroud)