Convert color to byte value

后端 未结 4 915
南方客
南方客 2021-01-28 15:28

In C#, how can I convert a Color object into a byte value?

For example, the color #FFF would be converted to the value 255

4条回答
  •  囚心锁ツ
    2021-01-28 16:01

    You could use the ColorTranslator.FromHtml function:

    Color color = ColorTranslator.FromHtml("#FFF");
    

提交回复
热议问题