I know how to set a control's BackColor dynamically in C# to a named color with a statement such as Label1.BackColor = Color.LightSteelBlue; ( using System.Drawing; )
But how do I convert a hex value into a System.Color , ie Label1.BackColor = "#B5C7DE
I would use the color translator as so:
var color = ColorTranslator.FromHtml("#FF1133");
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With