Fill datagridview cell with color
-
I want to fill the cells of a datagridview column based on numbers derived at runtime. Sounds easy enough but... these two lines of code work great if I only wanted red dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.Red; dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.Red; but these two lines just color the cells text (if existing)? or they just act bizzarly(although they worked good with a listview) dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.FromArgb(swLayer.Color); dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.FromArgb(swLayer.Color); Anyone have any pointer? wait a minute, no POINTERS, how about advice :)
-
I want to fill the cells of a datagridview column based on numbers derived at runtime. Sounds easy enough but... these two lines of code work great if I only wanted red dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.Red; dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.Red; but these two lines just color the cells text (if existing)? or they just act bizzarly(although they worked good with a listview) dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.FromArgb(swLayer.Color); dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.FromArgb(swLayer.Color); Anyone have any pointer? wait a minute, no POINTERS, how about advice :)
My
CP Vanity
article fills DGV cells with platinum, gold, silver, bronze. No problem, unless the cell is otherwise empty, then it may get tricky. :)Luc Pattyn [My Articles] Nil Volentibus Arduum
-
My
CP Vanity
article fills DGV cells with platinum, gold, silver, bronze. No problem, unless the cell is otherwise empty, then it may get tricky. :)Luc Pattyn [My Articles] Nil Volentibus Arduum
-
It is one of my articles, as I said. And it has a download link. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
I want to fill the cells of a datagridview column based on numbers derived at runtime. Sounds easy enough but... these two lines of code work great if I only wanted red dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.Red; dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.Red; but these two lines just color the cells text (if existing)? or they just act bizzarly(although they worked good with a listview) dataGridView1.Rows[layerCount].Cells[3].Style.BackColor = Color.FromArgb(swLayer.Color); dataGridView1.Rows[layerCount].Cells[3].Style.ForeColor = Color.FromArgb(swLayer.Color); Anyone have any pointer? wait a minute, no POINTERS, how about advice :)