I am trying to add color to the C # code, for example with the following color code.
ListTreeView.Background = New SolidColorBrush (Colors.White);
This is working .. But I want to add this color as a color code so that I can add
< P> system Drawing P> What can I do the following:ListTreeView.Background = ColorTranslator.FromHtml ("#FFE7EFF2");
This gives me an error; Any ideas?
There is no easy way to get a color with alpha contained in a hex string in this way.
I think your answer depends on where you get the color and alpha value.
Only RGB color can be parsed with HTML hex string: / P>
color color = translator. Form html ("# E7EFF2");
If you have a different alpha value, then you can apply it ():
color color = translator. Form html ("# E7EFF2"); Color transparent = color. Form ARBB (128, color);
Alternatively you may need to parse the string and split it to convert hex pairs to integer values.
PS is to excite English spelling, but the color must definitely be a definite 'U' in it :)
Comments
Post a Comment