I'm trying to make a functionality to create a mleader which has the same textstyle and text mask property as the mleaderstyle defined. Unfortunately I didn't get it. The newly created mleader don't has text mask property . here's the codes,. Can any one help me find what's the problem?
public static MLeader AddMleader(this Database db, List<Point3d> startPoints, Point3d endPoint, ObjectId styleNameId, string content)
{
MLeader ml = new MLeader();
MText mt = new MText();
try
{
ml.MLeaderStyle = styleNameId;
ml.SetFromStyle();
int leaderIndex = ml.AddLeader();
int ledearLineIndex = ml.AddLeaderLine(leaderIndex);
ml.AddFirstVertex(ledearLineIndex, startPoints[0]);
ml.AddLastVertex(ledearLineIndex, endPoint);
for (int i = 1; i < startPoints.Count; i++)
{
ledearLineIndex = ml.AddLeaderLine(leaderIndex);
ml.AddFirstVertex(ledearLineIndex, startPoints[i]);
}
mt.TextStyleId = ml.TextStyleId;
mt.Color = ml.TextColor;
mt.Contents = content;
//mt.TextHeight = ml.TextHeight;
ml.MText = mt;
}
catch (System.Exception ex)
{
mt.Dispose();
ml.Dispose();
}
return ml;
}