from KnownColor to Color

  • Thread starter Thread starter Fransis il Mulo
  • Start date Start date
F

Fransis il Mulo

I've a color picker on my asp.net UI. When I select an Item from DB I
read R,G, and B values. Then I'd like to move the color picker to the
right color. The color picker has a property xColor of type
System.Drawing.Color.

It's all right If I write this code:

colorPicker.xColor = System.Drawing.Color.Black;

but it's wrong if I write:

colorPicker.xColor = System.Drawing.Color.FromArgb(0, 0, 0);

I'm looking for a way to transform RGB color to KnownColor but the final
type must be System.Drawing.Color .

Can you help me?

Thanks

Fransis
 
Fransis il Mulo ha scritto:
I've a color picker on my asp.net UI. When I select an Item from DB I
read R,G, and B values. Then I'd like to move the color picker to the
right color. The color picker has a property xColor of type
System.Drawing.Color.

It's all right If I write this code:

colorPicker.xColor = System.Drawing.Color.Black;

but it's wrong if I write:

colorPicker.xColor = System.Drawing.Color.FromArgb(0, 0, 0);

I'm looking for a way to transform RGB color to KnownColor but the final
type must be System.Drawing.Color .

Can you help me?

Thanks

Fransis

.... I've already tried something like this without success:


System.Drawing.Color _color = System.Drawing.Color.FromArgb(0, 0, 0);
System.Drawing.KnownColor _knownColor = _color.ToKnownColor();
colorPicker.xColor = System.Drawing.Color.FromKnownColor(_knownColor);


.... while this code works fine:

colorPicker.xColor = System.Drawing.Color.Black;
 
Hi Fransis,

you should be able to do:

colorPicker.xColor = System.Drawing.Color.FromArgb(0,0,0).ToKnownColor();

What kind of color picker are you using?
 
Back
Top