.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create Mleader with text mask

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Brainstormcn
365 Views, 1 Reply

How to create Mleader with text mask

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;
        }

 

1 REPLY 1
Message 2 of 2
Brainstormcn
in reply to: Brainstormcn

I'v got the answer :mt.BackgroundFill = true;

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta