Assigning a BackColor in code
-
Hi, This may be a stupid question, but I'm having troubles assigning a hex value to the backcolor of a table cell with code. I'm currently adding values into a table with code, but I would like to change the back color by giving the color's hex code or #code. In the visual designer I can easily add the hex code, why not with code or am I forced to split it into blue, red and green or just use the basic system.drawing.color choices? Hope someone can help :) Kind regards
-
Hi, This may be a stupid question, but I'm having troubles assigning a hex value to the backcolor of a table cell with code. I'm currently adding values into a table with code, but I would like to change the back color by giving the color's hex code or #code. In the visual designer I can easily add the hex code, why not with code or am I forced to split it into blue, red and green or just use the basic system.drawing.color choices? Hope someone can help :) Kind regards
-
You create a Color value using the FromArgb method:
SomeTableCell.BackColor = Color.FromArgb(0xffff00); // yellow
orSomeTableCell.BackColor = Color.FromArgb(0x80, 0x80, 0x80); // grey
--- single minded; short sighted; long gone;