Hello Wagner and every body
Some time ago I asked the question about how to rotate a Block by code relative to a rotation point that I choose. I've got the Wonderful solution by Wagner:
procedure Rotate(B: TCustomDiagramBlock;NewAngle: Double;x,y:double);
var
Drawer: TBlockDrawer;
R: TSquare;
begin
B.RotationCenter:=dot(x,y);//x,y are given in relative coordinations
Drawer := TBlockDrawer.Create;
try
Drawer.RotationType := rtRotationCenter;
Drawer.RotationCenter :=TBlockHack(B).DiagramRotCenter;
Drawer.Angle := -B.Angle;
Drawer.CurRect := B.BoundsRect;
R := Drawer.RotByCenter(B.BoundsRect);
Drawer.Angle := NewAngle;
Drawer.CurRect := R;
B.BoundsRect := Drawer.RotByCenter(R);
B.Angle := NewAngle;
finally
Drawer.Free;
end;
end;
Now I have been struggling with another problem:
When I try to rotate by code only a textCell[0] belonging to a block (ex: textCell[0].angle:=45) , It seems that textcell[0] rotates around the center point of the hosting block, which is not desirable at all!!
My question is: How by code one can perform a rotation of a textcell[0] around the the center point of the textcell it self? It seems that this might require some specific code.
Please Help!