添加Paint事件,接着加入下列代码
//将头像设置成圆角 private void avatar_Paint(object sender, PaintEventArgs e) { GraphicsPath gp = new GraphicsPath(); gp.AddEllipse(avatar.ClientRectangle); Region region = new Region(gp); avatar.Region = region; gp.Dispose(); region.Dispose(); }