How to Customize DateTimeInput, DoubleInput, IntegerInput and TextBoxX colors
Categories: DotNetBar for Windows Forms, Edit Controls, How To
Colors customization for all controls in DotNetBar is done through Office2007ColorTable. Following code shows how to customize border color for input controls:
C#:
private void CustomizeColors() { Office2007Renderer renderer = GlobalManager.Renderer as Office2007Renderer; if (renderer == null) return; Office2007ColorTable table = renderer.ColorTable; // TextBoxX colors ElementStyle style = (ElementStyle)table.StyleClasses[ElementStyleClassKeys.TextBoxBorderKey]; style.BorderColor = Color.Red; // DateTimeInput, DoubleInput and IntegerInput Colors style = (ElementStyle)table.StyleClasses[ElementStyleClassKeys.DateTimeInputBackgroundKey]; style.BorderColor = Color.Green; // Stand-alone ComboBoxEx colors Office2007ComboBoxColorTable comboColors = table.ComboBox; comboColors.DefaultStandalone.Border = Color.Goldenrod; }
VB:
Private Sub CustomizeColors() Dim renderer As Office2007Renderer = CType(GlobalManager.Renderer, Office2007Renderer) If renderer Is Nothing Then Exit Sub End If Dim table As Office2007ColorTable = renderer.ColorTable ' TextBoxX colors Dim style As ElementStyle = CType(table.StyleClasses(ElementStyleClassKeys.TextBoxBorderKey), ElementStyle) style.BorderColor = Color.Red ' DateTimeInput, DoubleInput and IntegerInput Colors style = CType(table.StyleClasses(ElementStyleClassKeys.DateTimeInputBackgroundKey), ElementStyle) style.BorderColor = Color.Green ' Stand-alone ComboBoxEx colors Dim comboColors As Office2007ComboBoxColorTable = table.ComboBox comboColors.DefaultStandalone.Border = Color.Goldenrod End Sub
Related posts:
Leave a Reply!