日期:2014-05-18 浏览次数:21012 次
        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);
        }
    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();
        }
    }