ComponentOne Themes for WinForms
Applying a Built-In Theme to your Application
Themes for WinForms Quick Start > Applying a Built-In Theme to your Application

To simply theme the controls in your application use C1ThemeController like the following:

  1. Open a form belonging to your application in the Visual Studio's forms designer. In this example we will open a ComponentOne WinForms sample, SimpleTextEditor.

  2. From the designer's toolbox, drag a C1ThemeController and drop it on your form. (The C1ThemeController is provided by the C1.Win.C1Themes.4 assembly; if you don't see it in your toolbox you can add it manually).

    Note: Reference to C1.C1Zip.4.dll is required in a project that uses C1ThemeController.
    The C1ThemeController dialog box appears.

    This enables you to select the application-wide default theme, the current controller’s default theme, and themes for all supporting controls already on the form. Note: The same dialog is also available via the Set Themes action on the C1ThemeController tasks menu.

    Initially in the dialog that pops up, the theme is specified as "(none)" for all supporting controls already on the form. This is done to prevent unintentional loss of property settings on those controls.

  3. Click the All to (default) button in the dialog so that the default theme is set on all controls. If you have deliberately customized some of the controls already this will not need to be done.

    (When new controls are dropped on the form already containing a C1ThemeController component, theme is set to "(default)" on them automatically.)

  4. Select the default application theme from the list of available pre-built themes in the dropdown menu.

  5. Leave the theme on the current theme controller ('c1ThemeController1 theme') at its default "(default)" value (which means that the application theme, GreenHouse, will be used).

  6. Click the All to (default) button as mentioned above, to set the default theme on all supporting controls on the form.

  7. Click the OK button. You can observe that this launches a C1Themes Confirmation dialog box. This helps the user to decide whether or not to add the theme name and ApplicationTheme settings in the App.config (application configuration) file. Clicking the ‘No’ button does not add the application theme settings to the App.config file.

    Note: You can add the application theme settings to App.config file later by assigning the ApplicationTheme property:

    C1.Win.C1Themes.C1ThemeController.ApplicationTheme = "GreenHouse";
  8. If your application contains multiple forms, repeat the steps above (with the exception of specifying the default ApplicationTheme as it will already be pre-selected for you) for all forms in your application.

    When you are done, the selected application theme will be applied to controls on your forms both at design and runtime.

    The following image illustrates the GreenHouse theme applied to the SimpleTextEditor application: