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.
Let's explore how to add themes functionality to the PrintPreview control.
To customize the appearance of an Input control using Themes,
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(); } |
You can also add themes to the RibbonPreview control in the same way.