问个Panel重绘的问题,
private void panel1_Paint(object sender, PaintEventArgs e)
{
Rectangle rc = e.ClipRectangle;
rc.Width = rc.Width - 1;
rc.Height = rc.Height - 1;
e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Red)), rc);
}
上面我绘制Panel的边框,
为什么要加两行:
rc.Width = rc.Width - 1;
rc.Height = rc.Height - 1;
才能显示右边框和下边框,
如果不加这两行,那右边框和下边框就不显示出来,为什么?