public extern static int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref StructBorder strtborder);
public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref StructBorder strtborder);
private void SetupBorders() { if (System.Environment.OSVersion.Version.Major >= 6) //make sure you are not on a legacy OS { int IsXFrameEble = 0; StructBorder strtborder = new StructBorder(); //check if the desktop composition is enabled DwmIsCompositionEnabled(ref IsXFrameEble); if (IsXFrameEble > 0) { //left conner if (this.border.Left > 0) { this.PbxLeft.Visible = true; this.PbxLeft.Width = this.border.Left; strtborder.Left = this.border.Left; } else { this.PbxLeft.Visible = false; this.PbxLeft.Height = 0; strtborder.Left = 0; } //top corner if (this.border.Top > 0) { this.PbxTop.Visible = true; this.PbxTop.Height = this.border.Top; strtborder.Top = this.border.Top; } else { this.PbxTop.Visible = false; this.PbxTop.Height = 0; strtborder.Top = 0; } //right corner if (this.border.Right > 0) { this.PbxRight.Visible = true; this.PbxRight.Width = this.border.Right; strtborder.Right = this.border.Right; } else { this.PbxRight.Visible = false; this.PbxRight.Height = 0; strtborder.Right = 0; } //bottom corner if (this.border.Bottom > 0) { this.PbxBottom.Visible = true; this.PbxBottom.Height = this.border.Bottom; strtborder.Bottom = this.border.Bottom; } else { this.PbxBottom.Visible = false; this.PbxBottom.Height = 0; strtborder.Bottom = 0; } DwmExtendFrameIntoClientArea(this.Handle, ref strtborder); } } }