473,503 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

from KnownColor to Color

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
Dec 18 '07 #1
2 3809
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;
Dec 18 '07 #2
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?
Dec 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6597
by: Dariusz | last post by:
I have PHP code (below) which reads data from a MySQL format database. The problem I am having is trying to find out when the last ID entry was made. When the script is executed, the $gbID is...
7
7068
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
20
3900
by: de Beers | last post by:
mysql_query("DELETE FROM cart WHERE ItemId=$ItemId"); There is the code but the result in my databse is that the ID number changes from, lets say, 77 to 78 with 78's contents being empty. ...
7
2573
by: Thomas Gagne | last post by:
I anticipate wanting PHP to evaluate a lot of expressions and would rather not create subprocesses to do it from inside my C program. I've googled around for calling PHP from C, and know Apache...
3
8127
by: Daniel Pope | last post by:
Hello Everybody, I'm preparing for doing a daunting task: to access Out look Microsoft Outlook Express(regardles the operating system and Outlook version) from a Java applet (after the client...
5
13633
by: Rowland | last post by:
Hi, I know this question has prob. been asked a million times, but I couldn't find it in the FAQ, so here goes : I'm trying to write a Java applet to call a dll that resides on the web server...
467
21181
by: mike420 | last post by:
THE GOOD: 1. pickle 2. simplicity and uniformity 3. big library (bigger would be even better) THE BAD:
1
1137
by: Neo | last post by:
What is the "KnownColor" for ReadOnly text? Is there one?
2
2433
Ciary
by: Ciary | last post by:
hey all, is it possible to convert knownColor (in .NET framework) to RGB and visa versa using php? problem is, i got a foreign VB-application creating XML files which my website will need to...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.