13
Answers

C# Painting cells, rows , columns at runtime

Ask a question
David Smith

David Smith

14y
4.6k
1

Hi i want to be able to   Paint cells, rows , and columns at runtime.  


right now I have a sample code but its only painting to row 1 row. I want to be able to paint to all.
this is what i have so far.  Is there away I can just pick the color from the colordialog box at run time and display to the grid instead
of me assigning the color by code.


            if (checkBox1.Checked)
            {
                dataGridView2.Rows[1].DefaultCellStyle.BackColor = Color.White;
            }
            else
            {
                dataGridView2.Rows[1].DefaultCellStyle.BackColor = Color.Red;
            }

Answers (13)