Solved

Get the RGB values from the custom color in visual studio

Posted on 2009-07-03
1
645 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unresolved External Symbols 3 127
Paint/Redraw window while dragging 16 86
c++ syntax question 9 57
Outlook 13 79
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

685 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