When style property is set to Office 2007, 2010, 2013 or Metro style on DotNetBar controls the GlobalManager.Renderer is set to an instance of Office2007Renderer. Office2007Renderer or class that inherits from it and it provides rendering for Office styles.

Office2007Renderer.ColorTable returns reference to Office2007ColorTable object which defines all colors used by DotNetBar controls in Office Style.

To change the colors of current color table use following code, please note that its very important that changes to color table are done after the style on StyleManager is changed, otherwise your changes will be overwritten by system settings:

Example #1

C#

// Get Office2007Renderer
 
Office2007Renderer renderer = GlobalManager.Renderer as Office2007Renderer;
 
if (renderer == null)
    return;
 
// Get Office2007ColorTable
 
Office2007ColorTable ct = renderer.ColorTable;
 
// Customize colors
 
ct.Form.Active.CaptionText = Color.Green; // Form title text color
ct.Form.Inactive.CaptionText = Color.Yellow; // Form inactive title color
 
// Applies any current color table and any color changes to all controls and the form
 
RibbonPredefinedColorSchemes.ApplyOffice2007ColorTable(this);

VB

' Get Office2007Renderer

Dim renderer As Office2007Renderer = CType(GlobalManager.Renderer, Office2007Renderer)
 
If renderer Is Nothing Then Exit Sub
 
' Get Office2007ColorTable

Dim ct As Office2007ColorTable = renderer.ColorTable
 
' Customize colors

ct.Form.Active.CaptionText = Color.Green ' Form title text color
ct.Form.Inactive.CaptionText = Color.Yellow ' Form inactive title color

' Applies any current color table and any color changes to all controls and the form

RibbonPredefinedColorSchemes.ApplyOffice2007ColorTable(Me)

Example #2

To change text color for checked Button (ButtonItem.Checked=true) here is another example on how to customize color table to achieve that. It also shows how you can access and change other colors for buttons:

C#

if (GlobalManager.Renderer is Office2007Renderer)
{
    Office2007ColorTable ct = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
 
    ct.ButtonItemColors[0].Checked.Text = Color.Red;
}

VB

If TypeOf (GlobalManager.Renderer) Is Office2007Renderer Then
   Dim ct As Office2007ColorTable = DirectCast(GlobalManager.Renderer, Office2007Renderer).ColorTable
   ct.ButtonItemColors(0).Checked.Text = Color.Red
End If

Example #3

You can also assign the new instance of the Office2007ColorTable to the renderer.ColorTable in steps above if you want for example to change the Color Table to Back color table and customize its colors.

Code would look like this:

C#

// Get Office2007Renderer
 
Office2007Renderer renderer = GlobalManager.Renderer as Office2007Renderer;
 
if (renderer == null)
    return;
 
// Get Office2007ColorTable
 
Office2007ColorTable ct = new Office2007ColorTable(eOffice2007ColorScheme.Black);
renderer.ColorTable = ct;
 
// Customize colors
 
ct.Form.Active.CaptionText = Color.Green; // Form title text color
ct.Form.Inactive.CaptionText = Color.Yellow; // Form inactive title color
 
// Applies any current color table and any color changes to all controls and the form
 
RibbonPredefinedColorSchemes.ApplyOffice2007ColorTable(this);

VB

' Get Office2007Renderer

Dim renderer As Office2007Renderer = CType(GlobalManager.Renderer, Office2007Renderer)
 
If renderer Is Nothing Then Exit Sub
 
' Get Office2007ColorTable

Dim ct As Office2007ColorTable = New Office2007ColorTable(eOffice2007ColorScheme.Black)
renderer.ColorTable = ct
 
' Customize colors

ct.Form.Active.CaptionText = Color.Green ' Form title text color
ct.Form.Inactive.CaptionText = Color.Yellow ' Form inactive title color

' Applies any current color table and any color changes to all controls and the form

RibbonPredefinedColorSchemes.ApplyOffice2007ColorTable(Me)

Related posts:

  1. How to Access Office 2007 Color Table
  2. How to customize Office 2007 color table on per Bar or Control instance
  3. How to Customize DateTimeInput, DoubleInput, IntegerInput and TextBoxX colors
  4. How to customize Ribbon Application Button
  5. How to change & apply Ribbon Color Table