Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Individual RGB values from TColor....

Status
Not open for further replies.

onrdbandit

Programmer
Mar 12, 2003
145
US
Howdy,

I want to use a TColorDialog to allow the user to select a color, but the value returned is as of TColor type. I need to extract the individual values (red, green, and blue) from the TColor type.

If someone could explain how to seperate the values from the single value returned by ColorToRGB(TColor Color); that would solve my problem.

I cant seem to find any valid info on this topic. I have found some info saying the TColor type has member functions, but it does not seem to have a class stucture.

Thanks for any assitance...
onrdbandit
 
Search the documentation, because there is some functions that return each color : Red, Green, Blue.
Or you can apply some bit operation(binary and and shift to right) on the TColor variable to find each color.
TColor in hexa is something like this : 0xRRGGBB.


normal c++ programmer
 
You can use global windows defines:
GetRValue(DWORD rgb);
GetBValue(DWORD rgb);
GetGValue(DWORD rgb);
 
Thanks,

I found those functions, and they work great. I spent so long looking for answers without finding anything, that I wanted to make sure I was not searching in vain...

Thanks anyways,
onrdbandit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top