views:

32

answers:

0

I'm using TMS Diagram Studio. When I add a line (TCustomDiagramLine), it's caption is always in horizontal form. My problem is that if I try to change the orientation of the line, it's caption overlaps itself causing unreadability. I tried setting the left and top property of the caption basing on the position of the center point of the line but then I'm not getting my expectation. There's a difference between the ratio of the change position of the text and change position of the line when I move it.

These are the code snippets I tried:

procedure TForm1.atDiagramDControlMouseUp(Sender: TObject;
  ADControl: TDiagramControl; Button: TMouseButton; Shift: TShiftState; X,
  Y: Integer);
begin
  FControl := ADControl;
  TCustomDiagramLine(ADControl).TextCells[0].Left := Round(TCustomDiagramLine(ADControl).Points[0].X);
  TCustomDiagramLine(ADControl).TextCells[0].Top := Round(TCustomDiagramLine(ADControl).Points[0].Y);
end;

I used Round function to convert double to int. I guess that's one reason of the ratio difference but it should not be that big right? So I was thinking I made a mistake somewhere else..please help! thanks.