C#:玻璃表格?

时间:2011-07-05 03:08:53

标签: c# windows winforms themes aero

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

enter image description here

1 个答案:

答案 0 :(得分: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);

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

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