https://docs.devexpress.com/VCL/179004/ExpressGanttControl/getting-started/getting-started

procedure TForm3.FormCreate(Sender: TObject);
begin
   dxGanttControl1.LoadFromFile('test.xml');   //加载 任务
end;

procedure TForm3.保存任务Click(Sender: TObject);
begin
dxGanttControl1.SaveToFile('test.xml');
end;

 

 两个任务的关联

 在右边 持续 界面中,按住第一个任务,等鼠标 变化, 放松到目标 任务即可。

 用代码添加任务

uses DateUtils;
procedure TForm3.Button1Click(Sender: TObject);
var
  ADate: TDateTime;
  ATask: TdxGanttControlTask;
  ATaskCollection: TdxGanttControlTasks;
  I: Integer;
begin
  ATaskCollection := dxGanttControl1.DataModel.Tasks;  // Provides access to the task collection
  ADate := EncodeDateTime(2024, 03, 19, 8, 0, 0, 0);    //第一个任务的 时间
  for I := 1 to 10 do               //10 个任务
  begin
    ATask := ATaskCollection.Append;  // Appends a task to the collection
    ATask.Manual := False;  // Specifies that a task is automatically scheduled
    ATask.OutlineLevel := 1;  // Specifies a task's nesting level
    ATask.Start := ADate;  // Assigns a start date to a task
    ATask.Finish := ADate + EncodeTime(9, 0, 0, 0);  // Assigns a finish date to a task
    ATask.Name := 'Task #' + IntToStr(I);  // Specifies a task name
    if I > 1 then
      ATask.PredecessorLinks.Append.PredecessorUID := ATaskCollection[ATaskCollection.Count - 2].UID;  // Links a task to a predecessor
    ADate := IncDay(ADate);
// Checks if a task is planned on a workday
    while not dxGanttControl1.DataModel.ActiveCalendar.IsWorkday(ADate) do
      ADate := IncDay(ADate);
  end;
end;

 delphi dxGanttControl1 汉化

 

 

 

 其他类似