# Customize Bar

## Content



You can change the color, shape, or pattern of a bar to separate it from other bars of a particular type. You can customize the appearance of all the bar styles or you can customize the appearance of an individual GanttBar if you want to highlight a specific task in your plan. The **BarStyleCollection** class represents the collection of different bar styles in the **GanttView** control. You can customize the bar style at design time using the designer, or programmatically using the code.

### Change the bar style at design time

To change the bar style at design time, follow the steps given below:

1.  Right-click on the **C1GanttView** control and select Edit Bar Styles.<br />The **C1GanttView.BarStyles Collection Editor** appears.
2.  Click Add to add a bar style to the collection.
3.  Set the **BarType** to AutoTask.
4.  Set the **BarShape** to ThickBar.
5.  Click **Add** to add a bar style to the collection.
6.  Set the **BarType** to ManualTask.
7.  Set the **BarShape** to ThickBar.
8.  Set the **BarColor** to PaleGreen.
9.  Click **OK** to save and close the **C1GanttView.BarStyles Collection Editor**.

You can also change the bar style of a specific task at design time. To do so, open the Tasks Collection Editor and modify the **BarStyles** property for that specific task.

### Change the bar style programmatically

You can use the **BarStyles** property of the **C1GanttView** class to add a customized bar style to the **BarStyleCollection** class.<br />Below code snippet shows how you can change bar style in the C1GanttView.

```csharp
//Approach 1: Change bar style
BarStyle bs = c1GanttView1.GetPredefinedBarStyle(BarType.ManualTask);
bs.BarColor = Color.LightCoral;
c1GanttView1.BarStyles.Add(bs);
//Approach 2: Change bar style of a specific task
Task task3 = ganttView.Tasks.Search("Task 3");
    if (task3 != null)
    {
        BarStyle bs = ganttView.GetPredefinedBarStyle(BarType.ManualTask);
        bs.BarColor = Color.Green;
        bs.BarShape = BarShape.MiddleBar;
        bs.StartShape = 19;
        bs.EndShape = 19;
        task3.BarStyles.Add(bs);
    }
```