public static void RoundBorderForm(Form frm)
{
Rectangle Bounds = new Rectangle(0, 0, frm.Width, frm.Height);
int CornerRadius = 20;
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddArc(Bounds.X, Bounds.Y, CornerRadius, CornerRadius, 180, 90);
path.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y, CornerRadius, CornerRadius, 270, 90);
path.AddArc(Bounds.X + Bounds.Width - CornerRadius, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
path.AddArc(Bounds.X, Bounds.Y + Bounds.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
path.CloseAllFigures();
frm.Region = new Region(path);
frm.Show();
}
Nguồn
2015-07-05 09:34:15
Câu trả lời cho câu hỏi này có thể hữu ích: http://stackoverflow.com/questions/5092216/c-sharp-form-with-custom-border-and-rounded-edges –
Điều đó có vẻ tuyệt vời, nhưng um. .. Tôi mới nên ... tôi không biết phải đặt tất cả những thứ đó vào đâu. Tôi biết nơi để đặt mã dưới hình thức() điều, nhưng khác là khó khăn. Bạn có thể giúp tôi được không? –