pictureBox使用Region绘制后锯齿很明显 求助怎么能改成圆滑一些的?
pictureBox使用Region绘制后锯齿很明显 求助怎么能改成圆滑一些的? 请先看一下我的代码 不要直接给我例子 例子百度一下很多 但是套用不上
private GraphicsPath GetRectPath(Rectangle rect, int radius)
{
int diameter = radius;
Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
GraphicsPath path = new GraphicsPath();
// 左上角
path.AddArc(arcRect, 180, 90);
// 右上角
arcRect.X = rect.Right - diameter;
path.AddArc(arcRect, 270, 90);
// 右下角
arcRect.Y = rect.Bottom - diameter;
path.AddArc(arcRect, 0, 90);
// 左下角
arcRect.X = rect.Left;
path.AddArc(arcRect, 90, 90);
path.CloseFigure();//闭合曲线
return path;
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
GraphicsPath formPath = new GraphicsPath();
Rectangle rect = new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height);
formPath = GetRectPath(rect,10);
pictureBox1.Region = new Region(formPath);
}