Themes for WinForms | ComponentOne
ThemeController Overview / Theme Sources
In This Topic
    Theme Sources
    In This Topic

    In an application, themes can come from the following sources:

    The first two theme sources are available at design time via the C1ThemeController properties and designer actions. At runtime, you can also load themes in code from .c1theme files on disk using methods available on the C1ThemeController component.

    The built-in themes can be applied through code using the RegisterTheme and SetTheme methods and ApplicationTheme property of the C1ThemeController class. With the RegisterTheme method, the user can load a built-in theme from a file and register it for use by theme controllers in the application. The SetTheme method can be used to set control-wise themes, while the Application Theme property can set an application-wide theme, so that all the controls in an application that have "(default)" as their Theme property will use the same theme.

    'Register the theme file with the C1ThemeController
    C1.Win.C1Themes.C1ThemeController.RegisterTheme("C:\Users\Documents\Visual Studio 2010\Projects\ThemesBuild6\ThemesBuild6\NewOffice2013White.c1theme")
    
    'Apply it to a control, use the theme name, not the file name
    Me.C1ThemeController1.SetTheme(someControl, "NewOffice2013White")
    
    //Register the theme file with the C1ThemeController
    C1.Win.C1Themes.C1ThemeController.RegisterTheme(@"C:\Users\Documents\Visual Studio 2010\Projects\ThemesBuild6\ThemesBuild6\NewOffice2013White.c1theme");
    
    //Apply it to a control and use the theme name
    this.c1ThemeController1.SetTheme(somecontrol, "NewOffice2013White");
    
    'Sets the specified theme as the default application theme by C1ThemeControllers
    C1ThemeController.ApplicationTheme = "GreenHouse"
    
    //Sets the specified theme as the default application theme for C1ThemeControllers
    C1ThemeController.ApplicationTheme = "GreenHouse";