The mleader just uses the contents of the mtext or just just copies the contents.
To set the hieght use MLeader.TextHeight Property
Normally set it from its MleaderStyle.TextHeight
Leader.TextHeight = 30
instead of
mText.Height or TextHeight
<CommandMethod("TST_L", CommandFlags.Modal)> _
Public Sub TST_L()
Dim Doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = Doc.Editor
Dim db As Database = ed.Document.Database
Dim Dl As Autodesk.AutoCAD.ApplicationServices.DocumentLock = Doc.LockDocument(Autodesk.AutoCAD.ApplicationServices.DocumentLockMode.ProtectedAutoWrite, "", "", False)
Using Dl
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Dim btr As BlockTableRecord = DirectCast(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
Dim PtFleche As New Point3d(0, 0, 0)
Dim PtFleche2 As New Point3d(PtFleche.X + 4, PtFleche.Y + 4, PtFleche.Z)
Dim PtTexte As New Point3d(PtFleche.X + 8, PtFleche.Y + 6, PtFleche.Z)
Dim Leader As New MLeader
Leader.SetDatabaseDefaults()
Leader.ContentType = ContentType.MTextContent
'Leader.LayerId = CalqId
Leader.ArrowSize = 2.0
Leader.EnableDogleg = False
Dim idx As Integer = Leader.AddLeaderLine(PtFleche2)
Leader.AddFirstVertex(idx, PtFleche)
Leader.Annotative = AnnotativeStates.True
btr.AppendEntity(Leader)
tr.AddNewlyCreatedDBObject(Leader, True)
Using mText As New MText()
mText.Contents = "MyTexte"
Leader.MText = mText
End Using
Leader.TextHeight = 30
'Dim mlstyle As MLeaderStyle = Leader.MLeaderStyle.GetObject(OpenMode.ForRead)
'Leader.TextHeight = mlstyle.TextHeight
tr.Commit()
End Using
MsgBox("now change the annotation scale to 20 (for exemple)" & vbCrLf & _
"then restart the tst_l command" & vbCrLf & vbCrLf & _
"then look at the text height of the new leader" & vbCrLf & _
"it is le 20th of the previous one")
End Sub
You can also find your answers @
TheSwamp