PrintDocument for WinForms | ComponentOne
In This Topic
    Themes
    In This Topic

    PrintPreview and RibbonPreview library allows you to theme controls on the form. For this purpose, you can use the ThemeController component to load and manage C1 Visual Themes, and apply them to forms and controls. To learn more about ThemeController, refer the documentation for the Themes control. Adding the ThemeController to the forms  lets you view the controls in a number of themes which can be easily applied by setting a default theme.

    The image below depicts choosing a theme from a ComboBox to apply the same to the form and PrintPreview controls.

    GIF image of adding themes in PrintPreview control.

    Let's explore how to add themes functionality to the PrintPreview control.

    To customize the appearance of an Input control using Themes,

    1. Add the C1ThemeController control to your component tray and set the Theme property to default.
    2. Set the default theme on all supporting controls on the form.
    3. Add a ComboBox control to populate themes at runtime by invoking the Form_Load and ComboBox_SelectedValueChanged events and use the GetThemes property, as given in the code snippet below:

      C#
      Copy Code
      private void Form_Load(object sender, EventArgs e)
         {
              comboBox.Items.AddRange(C1ThemeController.GetThemes());
         }
      private void comboBox_SelectedValueChanged(object sender, EventArgs e)
         {
              c1ThemeController.Theme = comboBox.SelectedItem.ToString();
         }  
      
    4. Press F5 to run the application. Observe the output.

    You can also add themes to the RibbonPreview control in the same way.

    RibbonPreview control with themes applied.