Winform控件重绘
private void button1_Click(object sender, EventArgs e)
{
//定义控件宽、高
button1.Width = 100;
button1.Height = 100;
//定义矩形显示范围、位置
Rectangle re = this.button1.ClientRectangle;
re.Width-=10;
re.Height-=10;
re.X += 5;
re.Y += 5;
//定义绘制形状
GraphicsPath path = new GraphicsPath();
path.AddPie(re, (float)0, (float)360);
Region reg = new Region(path);
//赋值
this.button1.Region = reg;
//设置背景颜色
button1.BackColor = Color.Red;
}
重绘后形状如图: