修改控件形状的问题
GraphicsPath myPath = new GraphicsPath();
myPath.AddLine(30, 30, 60, 30);
myPath.AddLine(30, 30, 30, 60);
myPath.AddLine(30, 60, 60, 60);
myPath.AddLine(60, 30, 60, 60);
label1.Region = new Region(myPath);
label1.BackColor = Color.Blue;
使用这个代码之后lable1总是一个三角形,求解答
------解决方案--------------------改变一下顺序就可以了,必须是下一条线的起点是上一条线的终点
GraphicsPath myPath = new GraphicsPath();
myPath.AddLine(30, 30, 60, 30);
myPath.AddLine(60, 30, 60, 60);
myPath.AddLine(60, 60, 30, 60);
myPath.AddLine(30, 60, 30, 30);
label1.Region = new Region(myPath);
label1.BackColor = Color.Blue;