C#下有時候需要動态更新元件的背景色或者前景色,需用用到Brush,并把String表示的顔色值轉換為Brush對象,代碼:
Brush brush;
BrushConverter brushConverter = new BrushConverter();
brush = (Brush)brushConverter.ConvertFromString("#03ffea");//"#17acae");
C#下有時候需要動态更新元件的背景色或者前景色,需用用到Brush,并把String表示的顔色值轉換為Brush對象,代碼:
Brush brush;
BrushConverter brushConverter = new BrushConverter();
brush = (Brush)brushConverter.ConvertFromString("#03ffea");//"#17acae");