This is a migrated thread and some comments may be shown as answers.

ColorBox color input and output

3 Answers 193 Views
ColorBox
This is a migrated thread and some comments may be shown as answers.
Claude
Top achievements
Rank 1
Claude asked on 07 Jun 2012, 04:58 AM
I have been looking at the ColorBox control, but I cannot figure out how to do simple things.  What I want to do is specify the color displayed when the form containing the ColorBox control is opened, and extract the value of the new color chosen by the user.

I expected to be able to specify something like:

radColorBox1.InitialColor = Red;

and then get the new value if there is one. 

Apparently one gets the new value from the ValueChanging or ValueChanged event handlers, which is straightforward enough I guess.

I program in C#.  Any suggestions will be appreciated.

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 11 Jun 2012, 03:19 PM
Hello Claude,

Thank you for writing.

You can set RadColorBox value through the Value property for the initial state. For example in the OnLoad event of the form:
private void Form1_Load(object sender, EventArgs e)
{
  this.radColorBox1.Value = Color.Red;
}
Afterwards, as you have posted, you can track any changes through the ValueChanged/ing events.

I hope this will help. Should you have further questions, do not hesitate to write back.
 
Kind regards,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Art
Top achievements
Rank 1
answered on 28 Sep 2015, 07:05 PM
Ok, but what if I want the color to be "ffc5a8be" ?
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Sep 2015, 02:35 PM
Hello Art,

Thank you for writing.

RadColorBox accepts Color values. Hence, in order to specify the Value property you should convert the hex code to System.Drawing.Color. You can refer to the following StackOverflow thread that are useful on this topic:  
I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik

Tags
ColorBox
Asked by
Claude
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Art
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or