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

Color Dialog in Office 2007 Black Theme?

7 Answers 188 Views
ColorDialog
This is a migrated thread and some comments may be shown as answers.
Ching-Yen
Top achievements
Rank 1
Ching-Yen asked on 17 Mar 2008, 08:24 AM
Hi,

Is that possible to set the Color Dialog in Office 2007 Black Theme?

7 Answers, 1 is accepted

Sort by
0
Kiril
Telerik team
answered on 17 Mar 2008, 12:01 PM
Hello Ching-Yen,

Thank you for writing.

Currently, the RadColorDialog cannot be styled as a unit, and no themes are available for it. However, you might be able to achieve the desired appearance by setting properties of its elements yourself.

The RadColorSelector encapsulates the color selection logic. It is typically hosted by the RadColorDialogForm. However, you can customize the appearance and behavior of the component by initializing an instance manually, setting its appearance properties, and adding it to your own form to show it to the user. This approach is illustrated below, where the customization is the setting of the back color of the color selector to red.

Please refer to the codeblock below:
            Form colorDialogForm = new Form();  
            RadColorSelector cs = new RadColorSelector();  
            cs.BorderStyle = BorderStyle.Fixed3D;  
            cs.BackColor = Color.Red;  
            colorDialogForm.Controls.Add(cs);  
            colorDialogForm.Size = cs.Size;  
            cs.Dock = DockStyle.Fill;  
            DialogResult dr = colorDialogForm.ShowDialog(); 

In this fashion, you can set backcolors (and themes) to elements in the RadColorSelector, such as the buttons, or the tabstrip controlling the color selection mode. In the future, the RadColorSelector will be available in the toolbox, and you'll be able to modify it at design-time.

I hope this helps. If you have any additional questions, please let me know.

Best wishes,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ching-Yen
Top achievements
Rank 1
answered on 18 Mar 2008, 01:19 AM
Hi,

Thanks for the reply.

I only manage to change the back color of the control, but, not the buttons and tab control.

I was trying like
cs.btnNewColor <- but, the compiler gave me error on this..

Please advice.
0
Kiril
Telerik team
answered on 18 Mar 2008, 08:46 AM
Hi Ching-Yen,

The back color of the buttons and the tab control can be changed, by accessing the controls collection of the color dialog form. This code is brittle, as in the future the order of the controls in the controls collection might changein future versions of the component. Still, you can always go through all the children of the RadColorSelector and set their backcolor or theme name.

Refer to the codeblock below:

            RadColorDialogForm colorDialog = new RadColorDialogForm();  
  
            //add new color button  
            ((RadButton)((RadColorSelector)colorDialog.RadColorSelector).Controls[3]).ThemeName = "Office2007Black";  
            //tab strip  
            ((RadTabStrip)((RadColorSelector)colorDialog.RadColorSelector).Controls[4]).ThemeName = "Office2007Black";  
            //cancel button  
            ((RadButton)((RadColorSelector)colorDialog.RadColorSelector).Controls[5]).ThemeName = "Office2007Black";  
            //screen color picker button  
            ((RadButton)((RadColorSelector)colorDialog.RadColorSelector).Controls[6]).ThemeName = "Office2007Black";  
            //ok button  
            ((RadButton)((RadColorSelector)colorDialog.RadColorSelector).Controls[7]).ThemeName = "Office2007Black"

We recognize the need to provide a way to theme the control as a unit, rather than to style its children one by one. This is one of the improvements that will be added in future releases.

I hope this helps. If you have any further questions,please let me know.

Regards,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ching-Yen
Top achievements
Rank 1
answered on 18 Mar 2008, 03:40 PM
Hi,

Thanks for your reply. I do have a class
Public Class _myColorDialog
    Inherits Telerik.WinControls.UI.RadColorSelector

End Class

Where in the UI, I already placed a RadColorSelector. But all the buttons UI already been grayed out. I can't directly use the RadColorSelector Form as I need to add checkbox into the RadColorSelector.

For my case
DirectCast(_myColorDialog.Controls(3), RadButton).ThemeName = "Office2007Black" <- will not work as the compiler won't pass. Please advice.
0
Kiril
Telerik team
answered on 18 Mar 2008, 03:59 PM
Hello Ching-Yen,

Could you give me additional information on the exact compiler error you're getting? One possible reason for an error is that you're trying to modify the theme of a control that has not beed added to its parent's Controls collection.

Make sure you're calling the code I sent you after the call to the InitializeComponent method.

I hope this helps. If you need any additional assistance, please contact me again.

Kind regards,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ching-Yen
Top achievements
Rank 1
answered on 18 Mar 2008, 04:17 PM
Hi,

Thanks for the solution. Sorry, it's my fault that I placed the code @ the wrong place.

It works now !! Thanks !!
0
Kiril
Telerik team
answered on 18 Mar 2008, 04:38 PM
Hello Ching-Yen,

I'm glad to hear you've achieved the desired appearance.

If you have any additional questions, please do not hesitate to contact me.

Greetings,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ColorDialog
Asked by
Ching-Yen
Top achievements
Rank 1
Answers by
Kiril
Telerik team
Ching-Yen
Top achievements
Rank 1
Share this question
or