Page 1 of 1

Create TSimpleGraph

PostPosted: January 24th, 2005, 4:09 pm
by gdavin
Hello :)

I want to dynamically create a TSimpleGraph with TRectangularNode.

Where I can find some example ?

Thanks

PostPosted: January 24th, 2005, 4:45 pm
by Stefan
Hi,

Something like this should work:

Code: Select all
procedure TForm1.SomeProc;
begin
  Graph := TSimpleGraph.Create(Form1);
  with Graph do begin
    Parent := Form1;
    Left := 0;
    Top := 0;
    Width := 400;
    Height := 400;
    ZoomMax := 1000;
  end;
end;

procedure TForm1.SomeOtherProc;
var
  r: TRect;
  node: TGraphNode;
begin
  r := Rect(20, 20, 250, 50);
  node := Graph.InsertNode(@r);
  node.Text := 'Node text!';
end;



Cheers,
Stefan