Color Dialog in Office 2007 Black Theme?

8 posts, 0 answers
  1. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 17 Mar 2008 Link to this post

    Hi,

    Is that possible to set the Color Dialog in Office 2007 Black Theme?
  2. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 17 Mar 2008 Link to this post

    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:
    1             Form colorDialogForm = new Form();  
    2             RadColorSelector cs = new RadColorSelector();  
    3             cs.BorderStyle = BorderStyle.Fixed3D;  
    4             cs.BackColor = Color.Red;  
    5             colorDialogForm.Controls.Add(cs);  
    6             colorDialogForm.Size = cs.Size;  
    7             cs.Dock = DockStyle.Fill;  
    8             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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 17 Mar 2008 Link to this post

    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.
  5. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 18 Mar 2008 Link to this post

    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
  6. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 18 Mar 2008 Link to this post

    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.
  7. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 18 Mar 2008 Link to this post

    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
  8. Ching-Yen
    Ching-Yen avatar
    65 posts
    Member since:
    Nov 2007

    Posted 18 Mar 2008 Link to this post

    Hi,

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

    It works now !! Thanks !!
  9. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 18 Mar 2008 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready