



[DllImport("Dwmapi.dll")]
static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
targetHwnd = FindWindow(null, windowName);
RECT rect = new RECT { };
GetWindowRect(targetHwnd, out rect);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
MARGINS margins;
margins.left = 0;
margins.right = 0;
margins.top = width;
margins.bottom = height;
this.FormBorderStyle = FormBorderStyle.None;
this.TransparencyKey = Color.Black;
this.BackColor = Color.Black;
this.TopMost = true;
margins.top = width;
margins.bottom = height;
DwmExtendFrameIntoClientArea(this.Handle, ref margins);