ComponentOne Input for WinForms
Using the C1Input Controls / C1Input Controls / C1ColorPicker Control Overview / Working with C1ColorPicker / Applying Visual Styles to C1ColorPicker
In This Topic
    Applying Visual Styles to C1ColorPicker
    In This Topic

    Visual styles can be applied to the C1ColorPicker control using VisualStyle property. The smart tag on the top right corner of C1ColorPicker control lets users select the visual style they want to apply on the color picker.

    To Change the Visual Style using the Smart Tag

    Complete the following steps:
    1. Select the C1ColorPicker control.
    2. Click the smart tag (Smart Tag) to open the C1ColorPicker Tasks menu.
    3. Click the visual style drop-down arrow and select a visual style to apply on the C1ColorPicker control.

    To Change the Visual Style through Code

    The code snippets refer the color picker application created in Working with C1ColorPicker.

    1. Add the ComboBox control to the form.
    2. Add the following line of code to the application to get the visual styles in the ComboBox:
      VB
      Copy Code
      InitializeComponent()
      ComboBox1.DataSource = [Enum].GetValues(GetType(VisualStyle))
      
      C#
      Copy Code
      InitializeComponent();
      comboBox1.DataSource = Enum.GetValues(typeof(VisualStyle));
      
    3. Add code to the comboBox1_SelectedIndexChanged event handler so that the visual style of C1ColorPicker is updated on selecting an option from the combo box listing the available visual styles:
      VB
      Copy Code
      Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
          C1ColorPicker1.VisualStyle = DirectCast(ComboBox1.SelectedItem, VisualStyle)
      End Sub
      
      C#
      Copy Code
      private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
          c1ColorPicker1.VisualStyle = (VisualStyle)comboBox1.SelectedItem;
         
      }
      
    4. Run the application.
      Now you can select the visual style from the drop down of the combo box and set the visual style of the C1ColorPicker. The following image shows the output:
      VisualStyleColorpicker