开发者

Using hexadecimal color code in System.Drawing.Color

Is there a way to specify the hexadecimal code(something like #E9E9E9) while setting the co开发者_运维问答lor of a datagrid instead of using the below code.

dg.BackColor = System.Drawing.Color.LightGray


dg.BackColor =  System.Drawing.ColorTranslator.FromHtml("#E9E9E9");


try this :

dg.BackColor = Sytem.Drawing.Color.FromArgb(0, 0xE9, 0xE9, 0xE9);

or

string myColor = "#E9E9E9";
dg.BackColor = Sytem.Drawing.Color.FromArgb(int.Parse(myColor.Replace("#", "0x"));


Yes.

Color.FromArgb:

dg.BackColor = Color.FromArgb(0xE9, 0xE9, 0xE9);


Close:

Color.FromArgb(0, 0xe9, 0xe9, 0xe9);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜