Solved

Get the RGB values from the custom color in visual studio

Posted on 2009-07-03
1
635 Views
Last Modified: 2012-05-07
Hi Experts,

I am running microsoft visual studio. I have a gui that prompts the user to select a custom color from the color dialog box.

Below is the code I have currently to get the hue, saturation, and luminosity.

Unfortunately, I cannot find a way to directly get the RGB values, which I would like to use instead of those values.
Can you please replace the snippet of code below with the code that would get teh RGB values.

THanks,

Dennis
#pragma endregion

	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 

				 this->colorDialog1->ShowDialog();
 

				 // Write the hue to the screen which is measured in degrees, ranging from 0.0 through 360.0, in HSB color space.
 

				 this->textBox1->Text = safe_cast<IConvertible ^>(colorDialog1->Color.GetHue())->ToString(nullptr);
 

				 // Write the brightness to the screen which ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.
 

				 this->textBox6->Text = safe_cast<IConvertible ^>(colorDialog1->Color.GetBrightness())->ToString(nullptr);
 

				 // Write the saturation to the screen which ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated.
 

				 this->textBox2->Text = safe_cast<IConvertible ^>(colorDialog1->Color.GetSaturation())->ToString(nullptr);
 

			 }

Open in new window

0
Comment
Question by:datopdogg7
1 Comment
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
Comment Utility
how about
colorDialog1->Color.R  for the red component, (G and B fror green and blue)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now