Thread: Using Color Dialogs

  1. #1
    Registered User
    Join Date
    Apr 2012

    Using Color Dialogs

    I am using Visual C++ 2010 express, and found this control called Color Dialog. Now, I understand the concept and checked some of the methods but I would appreciate a help on this.

    I would like to GET and SET (both) a color from/to this color dialog but based on HSV values (not RGB).

    For example:

    GET values:

    I found there is something called GetHue so that I can get the Hue (H) value from the selected color . I suppose something like (correct me if I am wrong)

    HueValue=colorDialog1-> Color->GetHue();
    SET Values:

    Here is my problem. How to set the predefined color in the Color Dialog to reflect a set of HSV values??
    I can see in the control that there are values for HSL, so there must be a way to set these values, but how....

    Thank you in advance for your help

    Last edited by KansaiRobot; 05-13-2013 at 07:53 PM.

  2. #2
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    I don't believe you can. Have a quick search through MSDN for yourself, but I can't find any reference to setting the HSV directly. It appears to be only a convenience conversion and not settable.

    But, to be honest, it's not that hard to find the formula to convert HSV to RGB yourself and do things that way. In fact, there's a whole wikipedia article on it.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do i change backround color and text color?
    By Nathan the noob in forum C++ Programming
    Replies: 1
    Last Post: 02-17-2009, 04:39 AM
  2. static text color/background color
    By braindude in forum C++ Programming
    Replies: 1
    Last Post: 07-06-2003, 05:58 AM
  3. Dialogs
    By sean345 in forum Windows Programming
    Replies: 4
    Last Post: 09-01-2002, 06:05 PM
  4. CEditView Background Color & Font Color :: MFC
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 05-30-2002, 09:44 AM
  5. see-through dialogs
    By pinkcheese in forum Windows Programming
    Replies: 0
    Last Post: 05-06-2002, 08:56 AM