[AppleScript] 纯文本查看 复制代码
public partial class FrmMain : Form
{
#region 函数申明
[StructLayout(LayoutKind.Sequential)]
public struct Margins
{
public int Left;
public int Right;
public int Top;
public int Bottom;
}
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea
(IntPtr hwnd, ref Margins margins);
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();
#endregion
#region 重写方法
private Margins _margin;
protected override void OnLoad(EventArgs e)
{
if (DwmIsCompositionEnabled())
{
_margin = new Margins();
_margin.Right = _margin.Left = _margin.Bottom = _margin.Top = -1;
DwmExtendFrameIntoClientArea(Handle, ref _margin);
}
base.OnLoad(e);
}
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
if (DwmIsCompositionEnabled())
{
e.Graphics.Clear(Color.Black);
}
}
#endregion
public FrmMain()
{
InitializeComponent();
}
}