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.
To change the bar style at design time, follow the steps given below:
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.
You can use the BarStyles property of the C1GanttView class to add a customized bar style to the BarStyleCollection class.
Below code snippet shows how you can change bar style in the C1GanttView.
C# |
コードのコピー
|
---|---|
// 方法1:バーのスタイルを変更します。 BarStyle bs = c1GanttView1.GetPredefinedBarStyle(BarType.ManualTask); bs.BarColor = Color.LightCoral; c1GanttView1.BarStyles.Add(bs); // 方法2:特定のタスクのバースタイルを変更します。 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); } |