i have a question.
How can i write a graph that looks like:
I wrote the code:
- Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
Node: TRectangularNode;
Link: TGraphLink;
FGraph : TSimpleGraph;
i : Integer;
begin
NodeList.Free;
NodeList:= TGraphObjectList.Create();
LinkList.Free;
LinkList:= TGraphObjectList.Create;
FGraph := TSimpleGraph.Create(Self);
FGraph.SetBounds(10, 10, 400, 400);
FGraph.BeginUpdate;
for I := 0 to 4 do
begin
Node := TRectangularNode.Create(FGraph);
if ( (i mod 2)=0 ) then
begin
Node.SetBounds(1, 10 +(i*30), 10, 30);
Node.Brush.Color := clgreen;
Node.Alignment:=taCenter;
end
else
Node.SetBounds(1+(i*30), 10, 10, 30);
NodeList.Add(Node);
if ( (i mod 2)=0 ) then
NodeList.Items[i].Text := '0'
else
NodeList.Items[i].Text := '1';
end;
FGraph.CommandMode:=(cmEdit);
for I := 0 to 3 do
begin
Link := TGraphLink.Create(FGraph);
Link.Link(FGraph.Objects[0], FGraph.Objects[i+1]);
LinkList.Add(Link);
LinkList.Items[i].Text := IntToStr(i);
end;
Link.Font.Height := 15;
FGraph.LockLinks := True;
FGraph.EndUpdate;
FGraph.Parent := Self;
end;
Now the two links overlap.,.
How do i write in code, link like this one the highest and the lowest in the picture (round links).
Please help me.