...................................................................................
double direction = 1.0;
if ((endPoint - startPoint).DotProduct(Vector3d.XAxis) < 0.0)
{
direction = -1.0;
}
.....................................................................
if (direction > 0)
{
ml.TextAlignmentType = TextAlignmentType.LeftAlignment;
}
else
{
ml.TextAlignmentType = TextAlignmentType.RightAlignment;
}
............................................................................................