Need some help with RadColorBox

4 posts, 1 answers
  1. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 16 Apr 2012 Link to this post

    Hi,

    I have some problems using for the first time the RadColorBox. (last release Q1-2012) in vb net
    Documentation don't seem be outdated....

    So here my problems
    I Don't want to display as text of the selected color (I Want only the box filled with the selected color and the [...] Button
    I Don't want to show the Web and Basic tabs when the diaglog is showed
    (Documentation talk about  ShowBasicColors property, but I don't find it...)


    Any help will be great.

    Thanks

    Anthony
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 19 Apr 2012 Link to this post

    Hello Mr Filleau,

    Thank you for writing.

    The text box can be hidden by setting the MaxSize property of the ColorBoxElement to the size of the color box itself plus the size of the button.. This should be done in the Form.Load event of later, in order to allow the elements to calculate their size.

    In regards to the Web and Basic color sections, these can be removed by using the ShowWebColors and ShowBasicColors properties of the ColorDialogForm. Here is a sample snippet:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            RadColorBox1.ColorBoxElement.MaxSize = New Size(RadColorBox1.ColorBoxElement.ColorBox.Size.Width + RadColorBox1.ColorBoxElement.ColorPickerButton.Size.Width, 0)
            RadColorBox1.ColorDialog.ColorDialogForm.ShowWebColors = False
            RadColorBox1.ColorDialog.ColorDialogForm.ShowBasicColors = False
        End Sub

    I hope this helps. Let us know if you have any other questions. 

    All the best,
    Stefan
    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. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 22 Apr 2012 Link to this post

    Big Thank

    It Work ! But because my RadColorBox is in the RADPanel with the visible property set to False, I can't do it in the form load event and have to set my Radpanel.visible to Thrue in order to have a maxsize<>0
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 24 Apr 2012 Link to this post

    Hello Mr Filleau,

    In this case, you should use the VisibleChanged event of your RadPanel:
    Private Sub RadPanel1_VisibleChanged(sender As Object, e As System.EventArgs) Handles RadPanel1.VisibleChanged
            RadColorBox1.ColorBoxElement.MaxSize = New Size(RadColorBox1.ColorBoxElement.ColorBox.Size.Width + RadColorBox1.ColorBoxElement.ColorPickerButton.Size.Width, 0)
            RadColorBox1.ColorDialog.ColorDialogForm.ShowWebColors = False
            RadColorBox1.ColorDialog.ColorDialogForm.ShowBasicColors = False
        End Sub

    I hope this helps.

    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top