Click here to Skip to main content
15,906,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to put a rsa private key "hiden" in the code, and encrypt something with RSA! Sending the public key to decrypt. Pin
Ongcos17-Oct-10 22:51
Ongcos17-Oct-10 22:51 
GeneralRe: How to put a rsa private key "hiden" in the code, and encrypt something with RSA! Sending the public key to decrypt. Pin
Alegria_Lee18-Oct-10 4:34
Alegria_Lee18-Oct-10 4:34 
GeneralRe: How to put a rsa private key "hiden" in the code, and encrypt something with RSA! Sending the public key to decrypt. Pin
Ongcos7-Nov-10 22:23
Ongcos7-Nov-10 22:23 
QuestiongetPixel problem c# Pin
badescuga14-Oct-10 6:55
badescuga14-Oct-10 6:55 
AnswerRe: getPixel problem c# Pin
Rick Shaub14-Oct-10 7:11
Rick Shaub14-Oct-10 7:11 
GeneralRe: getPixel problem c# Pin
badescuga14-Oct-10 7:20
badescuga14-Oct-10 7:20 
AnswerRe: getPixel problem c# Pin
Luc Pattyn14-Oct-10 7:31
sitebuilderLuc Pattyn14-Oct-10 7:31 
QuestionRefresh User Control look Pin
Mazdak14-Oct-10 3:17
Mazdak14-Oct-10 3:17 
AnswerRe: Refresh User Control look Pin
Luc Pattyn14-Oct-10 3:35
sitebuilderLuc Pattyn14-Oct-10 3:35 
QuestionConvert color from RGB to Color name Pin
MrKBA14-Oct-10 0:22
MrKBA14-Oct-10 0:22 
AnswerRe: Convert color from RGB to Color name Pin
V.14-Oct-10 0:52
professionalV.14-Oct-10 0:52 
GeneralRe: Convert color from RGB to Color name Pin
MrKBA14-Oct-10 1:27
MrKBA14-Oct-10 1:27 
GeneralRe: Convert color from RGB to Color name Pin
V.14-Oct-10 1:35
professionalV.14-Oct-10 1:35 
GeneralRe: Convert color from RGB to Color name Pin
OriginalGriff14-Oct-10 1:48
mveOriginalGriff14-Oct-10 1:48 
GeneralRe: Convert color from RGB to Color name Pin
Luc Pattyn14-Oct-10 2:33
sitebuilderLuc Pattyn14-Oct-10 2:33 
GeneralRe: Convert color from RGB to Color name Pin
OriginalGriff14-Oct-10 3:46
mveOriginalGriff14-Oct-10 3:46 
AnswerRe: Convert color from RGB to Color name Pin
Keith Barrow14-Oct-10 1:56
professionalKeith Barrow14-Oct-10 1:56 
AnswerRe: Convert color from RGB to Color name Pin
PIEBALDconsult14-Oct-10 3:09
mvePIEBALDconsult14-Oct-10 3:09 
QuestionRe: Convert color from RGB to Color name Pin
Luc Pattyn14-Oct-10 3:33
sitebuilderLuc Pattyn14-Oct-10 3:33 
AnswerRe: Convert color from RGB to Color name Pin
PIEBALDconsult14-Oct-10 3:41
mvePIEBALDconsult14-Oct-10 3:41 
GeneralRe: Convert color from RGB to Color name Pin
Luc Pattyn14-Oct-10 3:59
sitebuilderLuc Pattyn14-Oct-10 3:59 
AnswerRe: Convert color from RGB to Color name Pin
W Balboos, GHB14-Oct-10 9:38
W Balboos, GHB14-Oct-10 9:38 
A quick and accurate solution for colors that actually have names:

Consider your color fields as a long (32 bit) unsigned int.


i.e., RGB(16,32,64) are actually the values (for three) of bytes.
Convert them so that each takes it's proper place in the long.
Find the value of the long for each of the named colors.
[How you decide to do this I leave as an exercise]

Then, create a switch with each of the known values as a case.
A default value catches the rest (convert to a sting "#rrggbb", for example)
Since this is C#, you can also do the reverse.

Other solution could involve you with the Color enum's.
Loads of ways to do this.

They can be built into a set of overloaded functions so you can make it even easier to convert from the RGB values to string and enum values.

Think of this as a viable (if not always the most efficient) pattern for many similar problems.








"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek dissappointment. If you are searching for perfection in yourself, then you seek failure." - Balboos HaGadol Mar 2010

GeneralRe: Convert color from RGB to Color name Pin
Keith Barrow14-Oct-10 13:00
professionalKeith Barrow14-Oct-10 13:00 
GeneralRe: Convert color from RGB to Color name Pin
PIEBALDconsult14-Oct-10 16:49
mvePIEBALDconsult14-Oct-10 16:49 
GeneralRe: Convert color from RGB to Color name Pin
W Balboos, GHB15-Oct-10 4:46
W Balboos, GHB15-Oct-10 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.