Back to Devexpress

Critical Path

windowsforms-402181-controls-and-libraries-gantt-control-critical-path.md

latest2.3 KB
Original Source

Critical Path

  • Sep 03, 2021

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.

Critical Tasks

Use a task’s IsCritical property to determine whether this task is on a critical path.

Critical Path Appearance

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.

csharp
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;
vb
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