using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("dwmapi.dll", PreserveSig = false)] public static extern bool DwmIsCompositionEnabled(); [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins); [StructLayout(LayoutKind.Sequential)] public struct MARGINS { public int Left; public int Right; public int Top; public int Bottom; } private void Form1_Load(object sender, EventArgs e) { // Form上にはlabelやtextboxを適当に配置して this.BackColor = Color.Black; if (DwmIsCompositionEnabled()) { MARGINS margin = new MARGINS(); margin.Top = -1; margin.Right = 0; margin.Left = 0; margin.Bottom = 0; DwmExtendFrameIntoClientArea(this.Handle, ref margin); } } } }