Appearance and styling
Visual settings are grouped under TTMSFNCGanttChart.Appearance:
DefaultItemAppearance, DefaultParentAppearance, and UnscheduledItemAppearance
control task-bar fills, strokes, fonts, and rounding; TimeLineAppearance,
TaskListAppearance, and SplitterAppearance style each panel; and
Appearance.Options holds quick toggles. For application-wide theming, set
AdaptToStyle := True so the chart follows the active FMX/VCL style instead of
its own colors.
procedure TForm1.StyleChart;
begin
TMSFNCGanttChart1.BeginUpdate;
try
TMSFNCGanttChart1.Appearance.ItemHeight := 36;
{ Use a single bar color instead of per-state colors, otherwise the state
fills win and the DefaultItemAppearance fill below has no visible effect. }
TMSFNCGanttChart1.Appearance.Options.DrawTasksByState := False;
{ Recolor the default task bar. }
TMSFNCGanttChart1.Appearance.DefaultItemAppearance.Fill.Kind := gfkSolid;
TMSFNCGanttChart1.Appearance.DefaultItemAppearance.Fill.Color := gcSteelblue;
{ Quick visual toggles. }
TMSFNCGanttChart1.Appearance.Options.ShowProgress := True;
TMSFNCGanttChart1.Appearance.Options.DrawTaskName := True;
TMSFNCGanttChart1.Appearance.Options.DrawParentTasks := True;
finally
TMSFNCGanttChart1.EndUpdate;
end;
end;
void __fastcall TForm1::StyleChart()
{
TMSFNCGanttChart1->BeginUpdate();
try
{
TMSFNCGanttChart1->Appearance->ItemHeight = 36;
// Use a single bar color instead of per-state colors, otherwise the state
// fills win and the DefaultItemAppearance fill below has no visible effect.
TMSFNCGanttChart1->Appearance->Options->DrawTasksByState = false;
// Recolor the default task bar.
TMSFNCGanttChart1->Appearance->DefaultItemAppearance->Fill->Kind = gfkSolid;
TMSFNCGanttChart1->Appearance->DefaultItemAppearance->Fill->Color = gcSteelblue;
// Quick visual toggles.
TMSFNCGanttChart1->Appearance->Options->ShowProgress = true;
TMSFNCGanttChart1->Appearance->Options->DrawTaskName = true;
TMSFNCGanttChart1->Appearance->Options->DrawParentTasks = true;
}
__finally
{
TMSFNCGanttChart1->EndUpdate();
}
}
What each appearance object controls
| Group | Controls |
|---|---|
DefaultItemAppearance |
Fill, stroke, font, and rounding of normal task bars. |
DefaultParentAppearance |
The same for summary (parent) tasks. |
UnscheduledItemAppearance |
Tasks with no start date. |
TimeLineAppearance |
Header and cell styling, TimeLineUnitWidth, GroupHeight. |
TaskListAppearance |
The left panel's fills, strokes, and fonts. |
SplitterAppearance |
The draggable splitter between panels. |
DependencyLine |
The stroke used for dependency arrows. |
SelectionGripAppearance |
The drag grips drawn on the selected task bar. |
CustomTaskAppearance / CustomParentTaskAppearance |
Per-chart bar appearance applied to tasks/parents when a custom item appearance is in effect. |
CustomTaskListAppearance / CustomTimeLineAppearance |
Export-only appearance used when PDF/print export enables UseCustomTaskListAppearance / UseCustomTimeLineAppearance — see Exporting to PDF and printing. |
Sizing and layout
Sizing lives directly on Appearance: ItemHeight (default 30),
HeaderHeight (default 52), SplitterWidth (default 6), and TaskListWidth
(default 300) — together these control the row height, header band, and the
split between the task-list and timeline panels.
Option toggles
Appearance.Options switches frequently-changed behavior without touching the
appearance objects:
ShowProgress— draw the progress fill inside each bar.DrawTaskName— render the task name on the bar.DrawParentTasks— show summary bars on the timeline.DrawUnscheduledTasks— show tasks that have no start date.DrawTasksByState— color bars from their assigned state.DrawHoverItem/DrawSelectionGrip— interaction affordances.
Following the application style
Set AdaptToStyle := True to make the chart pick up the active FMX or VCL style's
colors instead of its built-in palette — the simplest path to a consistent dark
or branded theme across a form.
Putting it together
Style the bars, switch on the option toggles, and hand theming over to the application style — all in one setup:
procedure TForm1.StyleEverything;
begin
TMSFNCGanttChart1.BeginUpdate;
try
{ Appearance objects: bar fill and sizing. }
TMSFNCGanttChart1.Appearance.ItemHeight := 34;
TMSFNCGanttChart1.Appearance.DefaultItemAppearance.Fill.Kind := gfkSolid;
TMSFNCGanttChart1.Appearance.DefaultItemAppearance.Fill.Color := gcSteelblue;
{ Option toggles. }
TMSFNCGanttChart1.Appearance.Options.ShowProgress := True;
TMSFNCGanttChart1.Appearance.Options.DrawTaskName := True;
TMSFNCGanttChart1.Appearance.Options.DrawParentTasks := True;
finally
TMSFNCGanttChart1.EndUpdate;
end;
{ Following the application style: AdaptToStyle overrides the manual colors
above with the active FMX/VCL style, for consistent theming. }
TMSFNCGanttChart1.AdaptToStyle := True;
end;
void __fastcall TForm1::StyleEverything()
{
TMSFNCGanttChart1->BeginUpdate();
try
{
// Appearance objects: bar fill and sizing.
TMSFNCGanttChart1->Appearance->ItemHeight = 34;
TMSFNCGanttChart1->Appearance->DefaultItemAppearance->Fill->Kind = gfkSolid;
TMSFNCGanttChart1->Appearance->DefaultItemAppearance->Fill->Color = gcSteelblue;
// Option toggles.
TMSFNCGanttChart1->Appearance->Options->ShowProgress = true;
TMSFNCGanttChart1->Appearance->Options->DrawTaskName = true;
TMSFNCGanttChart1->Appearance->Options->DrawParentTasks = true;
}
__finally
{
TMSFNCGanttChart1->EndUpdate();
}
// Following the application style: AdaptToStyle overrides the manual colors
// above with the active FMX/VCL style, for consistent theming.
TMSFNCGanttChart1->AdaptToStyle = true;
}
See also
- Task states —
DrawTasksByStatecolors bars by status. - Custom timeline drawing — per-element draw overrides.
TTMSFNCGanttChartAPI