An order flow in a few lines.
Create shapes and connectors in one undo step, then arrange them. The same API in Delphi, C++ Builder and C#. The layout call needs the Registered or Trial edition.
dotnet add package esegece.sgcDiagram.WinForms
C++ Builder and C# versions
uses
Forms, Controls,
sgcUICore_Theme, sgcDiagram_Types, sgcDiagram_Model,
sgcDiagram_Layout, sgcDiagram_VCL;
procedure BuildOrderFlow(aForm: TForm);
var
oView: TsgcVCLDiagramView;
oDoc: TsgcDiagramDocument;
oStart, oStock, oPay: TsgcDiagramNode;
oLayout: TsgcDiagramLayeredLayout;
begin
oView := TsgcVCLDiagramView.Create(aForm);
oView.Parent := aForm;
oView.Align := alClient;
oView.Theme := utDark;
oDoc := oView.Diagram;
oDoc.BeginTransaction('Order flow');
try
oStart := oDoc.AddNode(dgsTerminator, 0, 0, 140, 50, 'Order received');
oStock := oDoc.AddNode(dgsDecision, 0, 0, 160, 90, 'In stock?');
oPay := oDoc.AddNode(dgsProcess, 0, 0, 140, 60, 'Charge card');
oDoc.AddConnector(oStart, oStock);
oDoc.AddConnector(oStock, oPay).Labels.Add.Text := 'Yes';
finally
oDoc.EndTransaction;
end;
// arrange left to right, one undo step
oLayout := TsgcDiagramLayeredLayout.Create(oDoc);
try
oLayout.Direction := dglLeftToRight;
oLayout.Execute;
finally
oLayout.Free;
end;
oView.ZoomToFit;
end;