可以使用windowsAPI。
[DllImport("user32.dll")]
static extern int GetWindowRgn(IntPtr hWnd, long hRgn);
[DllImport("user32.dll")]
static extern int SetWindowRgn(IntPtr hWnd, long hRgn, bool bRedraw);
[DllImport("Gdi32.dll")]
static extern long CreateRectRgn(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect // y-coordinate of lower-right corner
);
public Form1()
{
InitializeComponent();
long hrgn =
//int Result = GetWindowRgn(this.Handle, hrgn);
CreateRectRgn(this.Left + 2, this.Top, this.Right - 2, this.Bottom - 2);
SetWindowRgn(this.Handle, hrgn, true);