windowsforms-402181-controls-and-libraries-gantt-control-critical-path.md
The GanttControl can highlight critical paths — sequences of dependent tasks that affect a project’s start or finish date. Use the CriticalPathHighlightMode option to specify how to highlight critical paths:
Single — The control highlights the longest sequence of dependent tasks that affect the project’s start or finish date.
Multiple — The control highlights all sequences of dependent tasks that affect the project’s start or finish date.
Run Demo: Code Examples - Critical Path.
Use a task’s IsCritical property to determine whether this task is on a critical path.
The default highlight color depends on the applied skin. You can use the Appearance collection’s CriticalPathTask and CriticalPathDependency properties to specify colors for tasks and dependency lines in critical paths.
using DevExpress.LookAndFeel;
using DevExpress.XtraGantt;
ganttControl.OptionsView.CriticalPathHighlightMode = CriticalPathHighlightMode.Single;
ganttControl.Appearance.CriticalPathTask.BackColor = DXSkinColors.FillColors.Danger;
ganttControl.Appearance.CriticalPathDependency.BackColor = DXSkinColors.FillColors.Danger;
Imports DevExpress.LookAndFeel
Imports DevExpress.XtraGantt
ganttControl.OptionsView.CriticalPathHighlightMode = CriticalPathHighlightMode.Single
ganttControl.Appearance.CriticalPathTask.BackColor = DXSkinColors.FillColors.Danger
ganttControl.Appearance.CriticalPathDependency.BackColor = DXSkinColors.FillColors.Danger