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

Need some help with RadColorBox

6 Answers 200 Views
ColorBox
This is a migrated thread and some comments may be shown as answers.
Filleau
Top achievements
Rank 1
Filleau asked on 16 Apr 2012, 04:00 PM
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

6 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 19 Apr 2012, 02:56 PM
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 >>
0
Filleau
Top achievements
Rank 1
answered on 22 Apr 2012, 07:37 AM
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
0
Stefan
Telerik team
answered on 24 Apr 2012, 02:37 PM
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 >>
0
pierre-jean
Top achievements
Rank 1
Veteran
Iron
answered on 15 Apr 2019, 10:31 AM

Well it does not work entirely for me.

I have my radcolorbox in a tablelayout component

- the radcolorbox has a dockfill value in the tablelayout cell

- When resetting the max size the radcolorbox no longer fits the entire width of the cell and a small part of the text is still visible

See the attached screen copy where the maxsize reet is currently applied only to the first radcolorbox (circled in red)

Thanks in advance

 

 

0
Dimitar
Telerik team
answered on 16 Apr 2019, 09:22 AM
Hello Pierre,

Instead of setting the MaxSize you can directly hide the TextBoxItem, you can stretch the color box as well:
radColorBox1.ColorBoxElement.TextBoxItem.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
radColorBox1.ColorBoxElement.ColorBox.StretchHorizontally = true;

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
pierre-jean
Top achievements
Rank 1
Veteran
Iron
answered on 16 Apr 2019, 10:00 AM

Thanks a lot

it works perfectly

Regards

Pierre Jean

Tags
ColorBox
Asked by
Filleau
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Filleau
Top achievements
Rank 1
pierre-jean
Top achievements
Rank 1
Veteran
Iron
Dimitar
Telerik team
Share this question
or