I need to convert a System.Windows.Media.SolidcolorBrush to a System.Drawing.Color in C# any clues would be great.
views:
80answers:
3
+3
A:
You can use SolidColorBrush.Color
to get or set the colour. This is a System.Windows.Media.Color
which has A, R, G, B properties.
You can then use those values when creating your System.Drawing.Color
System.Drawing.Color myColor = System.Drawing.Color.FromArgb(mediaColor.Color.A,
mediaColor.Color.R,
mediaColor.Color.G,
mediaColor.Color.B);
ChrisF
2010-08-11 11:23:36
Nice one thanks!!
Kaya
2010-08-11 11:37:37
A:
private System.Drawing.Color WpfBrushToDrawingColor(System.Windows.Media.SolidColorBrush br)
{
return System.Drawing.Color.FromArgb(
br.Color.A,
br.Color.R,
br.Color.G,
br.Color.B);
}
Nir
2010-08-11 11:26:08