Board.Board.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;
            Pen p = new Pen(Color.LightGray);
            int bias = resultlabel.Size.Height + 5;
            double cw = (this.Width - 1) / 32.0;
            double ch = ((this.Height - bias) - 1) / 32.0;
            int y = 0;

            for (int i = 0; i < 32; i++)
            {
                int h = (int)(ch * (i + 1)) - y;
                int x = 0;
                for (int j = 0; j < 32; j++)
                {
                    int w = (int)(cw * (j + 1)) - x;
                    Brush b = new SolidBrush(getColor(j, i));
                    g.FillRectangle(b, x, y + bias, w, h);
                    b.Dispose();
                    g.DrawRectangle(p, x, y + bias, w, h);
                    x += w;
                }
                y += h;
            }
            p.Dispose();

            int[] scores = this.Scores;
            resultlabel.Text = scores[0] + "[zk], " + scores[1] + "[stones], " + scores[2] + "[ms]";
            namelabel.Text = (this.name == null) ? "NoName" : this.name;
        }