How to create a System.Drawing.Color from its hexadecimal RGB string?

前端 未结 6 1517
-上瘾入骨i
-上瘾入骨i 2020-12-30 18:37

I want to create a System.Drawing.Color from a value like #FF00FF or FF00FF without needing to write code for that. There is any .NET

6条回答
  •  甜味超标
    2020-12-30 19:01

    You can use the System.Drawing.ColorTranslator static method FromHtml.

    use:

    System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
    

提交回复
热议问题