문제

I have downloaded and installed TSimpleGraph component but cannot really understand how to use it. I've checked the demo but it is too complexed for me and in Delphi (I use C++ Builder) to be able to dissect what I need.

What I am trying is to create two rectangles that are connect with an arrow line. Rectangles should be able to move when user drags them and the arrow should move accordingly (pointing from one rectangle to another). If someone could provide me with this example (Delphi or C++ Builder) I believe I could figure out the rest. Thanks in advance.

도움이 되었습니까?

해결책

procedure TForm1.FormCreate(Sender: TObject);
var
  Node: TRectangularNode;
  Link: TGraphLink;
begin
  FGraph := TSimpleGraph.Create(Self);
  FGraph.SetBounds(10, 10, 400, 400);
  FGraph.BeginUpdate;
  Node := TRectangularNode.Create(FGraph);
  Node.SetBounds(25, 25, 100, 50);
  Node := TRectangularNode.Create(FGraph);
  Node.SetBounds(200, 200, 50, 100);
  Link := TGraphLink.Create(FGraph);
  Link.Link(FGraph.Objects[0], FGraph.Objects[1]);
  FGraph.EndUpdate;
  FGraph.Parent := Self;
end;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top