How to set the position of leader text?

I want to create a custom leader in C #, but I can’t find how to set text to UnderLined. I don’t know which API controls this parameter
微信截图_20230921170126

current leader


Desired effect

This is my code

            Point3d[] pts = { new Point3d(300, 0, 0), new Point3d(0, 0, 0) };       

            var dimstyle = new DimensionStyle();
            dimstyle.Name = "Dim01";
            dimstyle.LeaderArrowBlockId = leftid;
            dimstyle.LeaderArrowType = DimensionStyle.ArrowType.UserBlock;
            dimstyle.ArrowType1 = DimensionStyle.ArrowType.UserBlock;
            dimstyle.ArrowType2 = DimensionStyle.ArrowType.UserBlock;
            dimstyle.LeaderArrowType = DimensionStyle.ArrowType.UserBlock;
            dimstyle.TextUnderlined = true;
            dimstyle.DimTextLocation = DimensionStyle.TextLocation.InDimLine;


            dimstyle.LeaderArrowLength = 50;
            dimstyle.ArrowBlockId1 = leftid;
            dimstyle.ArrowBlockId2 = leftid;
            dimstyle.TextHeight = 50;
            var dimstyleindex = doc.DimStyles.Add(dimstyle, false);

            doc.DimStyles.SetCurrent(dimstyleindex, true);
            var myleader = Leader.Create("5400", Plane.WorldXY, dimstyle, pts);
           

            doc.Objects.AddLeader(myleader);
            doc.Views.Redraw();



            // TODO: complete command.
            return Result.Success;

Hi @Fan,

Try setting DimensionStyle.TextVerticalAlignment to TextVerticalAlignment.BottomOfBoundingBox.

– Dale

Thanks for the answer, but I tried maybe dimstyle.LeaderTextVerticalAlignment = TextVerticalAlignment.BottomOfBoundingBox; is the right way!