Azmyth.Editor.ColorTool.Grid_Paint C# (CSharp) Method

Grid_Paint() private method

private Grid_Paint ( object sender, PaintEventArgs e ) : void
sender object
e PaintEventArgs
return void
        private void Grid_Paint(object sender, PaintEventArgs e)
        {
            float colorSize = ColorSize;
                Graphics graphics = e.Graphics;

                for(int i = 0; i <= 255; i++)
                {
                    graphics.FillRectangle(new SolidBrush(Color.FromArgb(i, i, i)), i*colorSize, 0, colorSize, this.Height);
                }

                if(m_selected != null)
                {
                    graphics.DrawRectangle(new Pen(Brushes.Red, 2), m_selected.X, 1, m_selected.Width-1, m_selected.Height-4);
                }

                graphics.FillRectangle(new SolidBrush(Color.FromArgb(m_selectedColor, m_selectedColor, m_selectedColor)), (int)(this.Width - this.Height), 0, (int)this.Height, (int)this.Height);
                graphics.DrawRectangle(new Pen(Brushes.Red, 3), this.Width - this.Height, 0, this.Height-3, this.Height-3);
        }