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

    The smart tag on the top right corner of the C1FontPicker control lets users select the visual style of the C1FontPicker.

    To Change the Visual Style using the Smart Tag

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

    To Change the Visual Style through Code

    The code snippets refer the font picker application created in Working with C1FontPicker.

    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()
      ComboBox2.DataSource = [Enum].GetValues(GetType(VisualStyle))
      
      C#
      Copy Code
      InitializeComponent();
      comboBox2.DataSource = Enum.GetValues(typeof(VisualStyle));
      
    3. Add code to the comboBox1_SelectedIndexChanged event handler so that the visual style of C1FontPicker is updated on selecting an option from the combo box listing visual styles available:
      VB
      Copy Code
      Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
          C1FontPicker1.VisualStyle = DirectCast(ComboBox2.SelectedItem, VisualStyle)
      End Sub
      
      C#
      Copy Code
      private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
      {
          c1FontPicker1.VisualStyle = (VisualStyle)comboBox2.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 C1FontPicker. The following image shows the output:
      visualstylefontpicker