Solved

Get the RGB values from the custom color in visual studio

Posted on 2009-07-03
1
642 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
ID: 24770686
how about
colorDialog1->Color.R  for the red component, (G and B fror green and blue)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

828 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