记住,form的FormBorderStyle选择为None;
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y,
e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1);
g.DrawRectangle(new Pen(Color.FromArgb(121, 121, 121)), rect);
}
在窗口放大,缩小期间要记得重写resize事件
private void Form1_Resize(object sender, EventArgs e)
{
this.Invalidate();
}