日期:2014-05-18 浏览次数:20973 次
private void panel1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawRectangle(Pens.Black, new Rectangle(2, 2, panel1.Width - 5, panel1.Height - 5)); }
------解决方案--------------------
将panel的borderStyle属性改下就有边框了,边框是黑色的,,如果不想是黑色就照楼上的做,改下颜色
private void panel1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(Pens.LightGreen, new Rectangle(2, 2, panel1.Width - 5, panel1.Height - 5));
}