Back to Devexpress

TdxGanttControlTimelineViewGetTaskColorEvent Type

vcl-dxganttcontrolviewtimeline-51d64c31.md

latest2.7 KB
Original Source

TdxGanttControlTimelineViewGetTaskColorEvent Type

The color-related procedural type for tasks in the Timeline View.

Declaration

delphi
TdxGanttControlTimelineViewGetTaskColorEvent = procedure(Sender: TdxGanttControlTimelineView; ATask: TdxGanttControlTask; var AColor: TColor) of object;

Parameters

NameTypeDescription
SenderTdxGanttControlTimelineView

The Timeline View that raised the event.

| | ATask | TdxGanttControlTask |

The task whose color is about to be changed.

| | AColor | TColor |

A system palette color.

|

Remarks

The following code example fills all outdated tasks with red (clRed):

delphi
procedure TMyForm.FormCreate(Sender: TObject);
begin
  // Loads a chart from the specified XML file
  dxGanttControl1.LoadFromFile('C:\Users\Public\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressGanttControl\Data\SoftwareDevelopment.xml');
end;

procedure TMyForm.dxGanttControl1ViewTimelineGetTaskColor(
  Sender: TdxGanttControlChartView; ATask: TdxGanttControlTask;
  var AColor: TColor);
begin
  // Checks if the inspected task exists and compares its date with the current date
  if (ATask <> nil) and (ATask.Finish < Now) then
    // Fills outdated tasks with the red color
    AColor := clRed;
end;
cpp
{
void __fastcall TMyForm::FormCreate(TObject *Sender)
{ // Loads a chart from the specified XML file
  dxGanttControl1->LoadFromFile("C:/Users/Public/Documents/DevExpress VCL Demos/MegaDemos/Product Demos/ExpressGanttControl/Data/SoftwareDevelopment.xml");
}
//---------------------------------------------------------------------------
void __fastcall TMyForm::dxGanttControl1ViewTimelineGetTaskColor(TdxGanttControlChartView *Sender,
          TdxGanttControlTask *ATask, TColor &AColor)
{
// Checks if the inspected task exists and compares its date with the current date
if (ATask != NULL && ATask->Finish < Now()) 
  {
      // Fills outdated tasks with the red color
      AColor = clRed;
  }
}

See Also

OnGetTaskColor

TdxGanttControlChartView.OnGetTaskColor

TdxGanttControlChartView.OnGetLinkColor

dxGanttControlViewTimeline Unit