110,569
社区成员
发帖
与我相关
我的任务
分享
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics grfx = e.Graphics;
Rectangle rect = ClientRectangle;
rect.Inflate(new Size(-100, -100));
grfx.DrawRectangle(new Pen(Color.Black), rect);
}
this.SetStyle(ControlStyles.ResizeRedraw, true);
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.DoubleBuffered = true;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle rect = this.ClientRectangle;
rect.Inflate(-100, -100);
e.Graphics.DrawRectangle(Pens.Black, rect);
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
this.Invalidate();
}
}