0

i am getting a color name as string (like "Black"). have to convert that color name as SharpDX.Color for my Metro app. now trying in following ways,

1)SharpDX.Color.FromRgba(int or uint value of color)
2)SharpDX.Color.FromArgb(int or uint value of color)

is it possible to do this in this way.? or any other best way to done this.??

Maniarasu
  • 362
  • 5
  • 15

1 Answers1

0

Using Enum Parse and System.Drawing can help, it's not great but that would work:

KnownColor colorenum = (KnownColor)Enum.Parse(typeof(KnownColor),"Black");

Color4 bgcolor = new Color4(Color.FromKnownColor(colorenum).ToArgb());

Otherwise you can build a custom Dictionary with string as key and SharpDX.Color4 as value, and create your own list of colors.

mrvux
  • 8,523
  • 1
  • 27
  • 61