开发者

How can I fill a Rectangle with a Hexadecimal color value?

开发者 https://www.devze.com 2023-01-06 04:22 出处:网络
\'#10eeee\' 开发者_运维百科Here\'s what I\'m trying to do: groupRectangle.Fill = Color.FromHex? You\'re looking for ColorConverter.ConvertFromString.
'#10eeee'

开发者_运维百科Here's what I'm trying to do:

groupRectangle.Fill = Color.FromHex?


You're looking for ColorConverter.ConvertFromString.

Color color = (Color)ColorConverter.ConvertFromString("#10eeee");
SolidColorBrush myBrush = new SolidColorBrush(color);

You will need using System.Windows.Media; at the top of your program too.

The following string Color formats should be supported.

Edit: You can also use BrushConverter.

0

精彩评论

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