ColorBox color input and output

4 posts, 0 answers
  1. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 06 Jun 2012 Link to this post

    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.
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 11 Jun 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Art
    Art avatar
    54 posts
    Member since:
    Dec 2010

    Posted 28 Sep 2015 in reply to Ivan Petrov Link to this post

    Ok, but what if I want the color to be "ffc5a8be" ?
  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 29 Sep 2015 Link to this post

    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

Back to Top