把Panel设置成无边框,就是panel的BorderStyle属性为None
为panel添加Paint事件
private void panel1_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics, this.panel1.ClientRectangle,
Color.Red, 1, ButtonBorderStyle.Solid,
Color.Blue, 1, ButtonBorderStyle.Solid,
Color.Yellow, 1, ButtonBorderStyle.Solid,
Color.Green, 1, ButtonBorderStyle.Solid);
}