Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.36/5 (4 votes)
See more:
I Know a Math Function For Convert RGB Colors to OLE Colors :

((Red) + (Green * 256) + (Blue * 256 * 256))

I Want to Know How to Convert OLE to RGB Without Use ColorTranslator.FromOle
Please This Time Give Me a Correct Answer
I Think When RGB to OLE Have Math Operation Certainly OLE to RGB Have a Math
Operation too

For Beginner Programers Use RGB to OLE Math Function Have No Problem

Thanks
Posted
Updated 12-May-21 0:11am
Comments
Richard MacCutchan 8-Oct-12 10:57am    
It's just the reverse of what you have shown in your question.

1 solution

You can consider the below calculation to get the RGB values and hence the color.

var ole = 6579300;
var red = ole % 256;
var green = (ole / 256) % 256;
var blue = (ole / 65536) % 256;
var backToOle = red + (green * 256) + (blue * 256 * 256); (As you mentioned)

Thanks,
SJ
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900