from KnownColor to Color

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
 
F

Fransis il Mulo

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;
 
A

Andrew

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top