CColor class Overview Missouri

encapsulates the GDI color value (COLORREF)

Local Companies

Trabon Solutions
(816) 926-9800
420 E Bannister Rd
Kansas City, MO
STL EHR Group
314-477-7459
689 Craig Road
Creve Coeur, MO
Client Server Solutions Inc
314-523-4400
2008 Altom CT
St. Louis, MO
Quest Software Inc
314-523-4400
2008 Altom CT
St. Louis, MO
Amgraf Inc
816-474-4797
1501 Oak St
Kansas City, MO
Punch Software LLC
816-891-0025
7900 NW 100th St
Kansas City, MO
Wonderware Central
888-676-9933
Two City Place Drive
St. Louis, MO
Drafix Software
816-842-4955
114 W 3rd St
Kansas City, MO
Open Software Technology
314-854-9138
7777 Bonhomme Ave
St. Louis, MO
Amber Computer Solutions
(816) 746-0070
8506 N Mattox Rd Apt R146
Kansas City, MO

provided by: 
Originally published at Internet.com


This article was contributed by Christian Rodemeyer. [Method overview] The class CColor encapsulates the GDI color value (COLORREF) and adds some comfortable functions: direct manipulation of RGB and HSL attributes, conversion to string values for storage (registry, databases) and user-friendly color names. By userdefined constructors and conversions is it possible to use a CColor object everywhere a COLOREF value is expected. The attributes red, green and blue can be separatly accessed. This is an improvement compared with the use of makros like RGB, GetRValue, GetBValue and GetGValue. Likewise the attributes of the HLS color model (hue, luminance and saturation) can be separatly read and manipulated. In this manner it is very easy to draw color gradients like the title bars of Windows98 application or a "Choose Color" dialog. The MSDN Library provides an article which describes the HLS color model under the title "HLS Color Spaces". Colors could principially be stored in the registry or in databases numerically as DWORDs, but their manipulation through regedit like tools or SQL is unneccessarily complicated in this form. But it is more clever to store colors as text in the hexadecimal format RRGGBB. This text could be, in the worst case, manipulated by hand from some experienced user or system administrator. To get and set the text representation of a color you can use the handy GetString and SetString methods. Under X11 you can use named colors since long. HTML (respectively Internet Explorer) supports them too. Constants and strings are defined for every named color supported by Internet Explorer. Using named colors makes code more readable, because the constant "chocolate" is more understandable than the expression "RGB(0xD2691E)". The name of a color could also be determined as a string data type. It can be used as a means of communication between program and user. Remark: The CColor class does not support palettes and has therefore the greatest use, if windows is be used with more than 256 colors (color depth greater or equal 15/16bit)

Method Overview

CColor Consturctor for COLORREF compatibility. operator COLORREF Conversion operator for COLORREF compatibility. RGB SetRed Sets the red portion of the color (0 - 255). SetGreen Sets the green portion of the color (0 - 255). SetBlue Sets the blue portion of the color (0 - 255). SetRGB Sets the red, green and blue portion of the color in one step. GetRed Gets the red portion of the color (0 - 255). GetGreen Gets the green portion of the color (0 - 255). GetBlue Gets the blue portion of the color (0 - 255). HSL SetHue Sets the hue (0.0 - 360.0, angle in color circle). SetLuminance Sets the luminance (0.0 - 1.0). SetSaturation Set the saturation (0.0 - 1.0). SetHLS Sets the hue, luminance and saturation in one step. GetHue Gets the hue (0.0 - 360.0, angle in color circle). GetLuminance Gets the luminance (0.0 - 1.0). GetSaturation Liefert die Farbsättigung (Wertebereich: 0.0 - 1.0). String SetString Sets the color through extracting it from a string in the hexadecimal format RRGGBB GetString Gets a string which describes the color as a value in the hexadecimal format RRGGBB. Named Colors GetName Gets the user friendly name of the color Farbe. Static GetNameFromIndex Gets the name belonging to a value of ENamedColorIndex . GetColorFromIndex Gets a CColor object, which is initialized with the color represented by a value of ENamedColorIndex GetNumNames Gets the number of named colors. -----------------------------------

Konstanten

CColor::ENamedColor

...

Read article at Internet.com site

Featured Local Company

Punch Software LLC

816-891-0025
7900 NW 100th St
Kansas City, MO

Regional Articles
- CColor class Overview Arnold MO
- CColor class Overview Ballwin MO
- CColor class Overview Belton MO
- CColor class Overview Blue Springs MO
- CColor class Overview Bolivar MO
- CColor class Overview Branson MO
- CColor class Overview Cape Girardeau MO
- CColor class Overview Chesterfield MO
- CColor class Overview Columbia MO
- CColor class Overview De Soto MO
- CColor class Overview Excelsior Springs MO
- CColor class Overview Fenton MO
- CColor class Overview Festus MO
- CColor class Overview Florissant MO
- CColor class Overview Gladstone MO
- CColor class Overview Grandview MO
- CColor class Overview Hannibal MO
- CColor class Overview Hazelwood MO
- CColor class Overview Independence MO
- CColor class Overview Jefferson City MO
- CColor class Overview Joplin MO
- CColor class Overview Kansas City MO
- CColor class Overview Kirksville MO
- CColor class Overview Lebanon MO
- CColor class Overview Lees Summit MO
- CColor class Overview Liberty MO
- CColor class Overview Maryland Heights MO
- CColor class Overview Moberly MO
- CColor class Overview Neosho MO
- CColor class Overview Nixa MO
- CColor class Overview North Kansas City MO
- CColor class Overview O Fallon MO
- CColor class Overview Pacific MO
- CColor class Overview Park Hills MO
- CColor class Overview Perryville MO
- CColor class Overview Poplar Bluff MO
- CColor class Overview Rolla MO
- CColor class Overview Saint Ann MO
- CColor class Overview Saint Charles MO
- CColor class Overview Saint Joseph MO
- CColor class Overview Saint Louis MO
- CColor class Overview Saint Peters MO
- CColor class Overview Sedalia MO
- CColor class Overview Sikeston MO
- CColor class Overview Springfield MO
- CColor class Overview Warrensburg MO
- CColor class Overview West Plains MO
Related Local Events
Ozarks Technical Community College Center for Workforce Development: IT Consortium Planning Meeting
Dates: 12/3/2009 - 12/3/2009
Location: Springfield Area Chamber of Commerce
Springfield, MO
View Details

60 Minutes to Success: WWW: Who, What and Where do I turn to for my IT needs
Dates: 10/7/2009 - 10/7/2009
Location: Springfield Area Chamber of Commerce
Springfield, MO
View Details

Girls in Science, Technology, Engineering and Mathematics: Exploring Opportunities and Opening Doors
Dates: 10/6/2009 - 10/6/2009
Location: Metropolitan Community College
Kansas City, MO
View Details

BarCampKC
Dates: 9/26/2009 - 9/26/2009
Location: JavaportKC
Kansas City, MO
View Details

Brain Food-Discover the 21st Century Virtual Office
Dates: 9/16/2009 - 9/16/2009
Location: World Trade Center Room
Kansas City, MO
View Details

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML