给你个列子吧。你自己套用下看看效果如何
[DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr hObject);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateRoundRectRgn(int x1, int y1, int x2, int y2, int cx, int cy);
private void button2_Click(object sender, EventArgs e)
{
Size Size = this.button1.Bounds.Size;
IntPtr Rgn = CreateRoundRectRgn(1, 1, Size.Width, Size.Height, 6, 6);
if (Rgn != null)
{
SetWindowRgn(this.listView1.Handle, Rgn, true);
DeleteObject(Rgn);
}
}
//代码中的6中控件圆角值你可以改成和你控件实现圆角值。这样就可以了