Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » How do I get access to the active colours? Collapse All
Subject Author Date
Andrew Brown Aug 15, 2007 - 12:56 PM

I’d like to paint my custom controls to match the style of the currently selected theme so how can I get access to the colours being used to paint backgrounds, borders etc.

Technical Support Aug 16, 2007 - 5:08 AM

In Elegant UI there is no such a thing like the system color set in Windows. Every themed control is painted using a skin object of class derived from Elegant.Ui.ControlSkin. Every skin object contains a collection of objects derived from the Elegant.Ui.ControlPaintInformation class which is used for storing paint information for every UI state that control supports (like hovered, pressed, disabled, etc). In the most cases the control background is painted with bitmaps. Anyway, tell us what kind of control do you want to paint so we can come up with a solution.

Andrew Brown Aug 16, 2007 - 2:58 PM

It would be enough for me to know the active colours being used for the backgrounds of Elegant.Ui.Panel and Elegant.UI.TextBox and the border and text colour of Elegant.UI.TextBox. Is it possible to get these from properties somewhere?

Technical Support Aug 17, 2007 - 5:55 AM

You can retrieve the background color of Elegant.Ui.Panel using the following code

PanelSkin panelSkin = (PanelSkin)SkinManager.GetSkin("Panel");
Color panelBackColor = panelSkin.GetPaintInformation(ControlState.Normal).BackgroundGlyph.BackgroundColor;
The code below allows you to get the border color and the text color of Elegant.Ui.TextBox
TextBoxSkin textBoxSkin = (TextBoxSkin)SkinManager.GetSkin("TextBox.TextBox");
TextBoxPaintInformation textBoxPaintInformation = (TextBoxPaintInformation)
textBoxSkin.GetPaintInformation(TextBoxState.Normal); // This way you can get paint information for any textbox state
Color borderColor = textBoxPaintInformation.BorderGlyph.BackgroundColor;
Color textColor = textBoxPaintInformation.ForegroundColor;

Andrew Brown Aug 17, 2007 - 12:31 PM

That’s perfect, thank you!