MText.WidthFactor
William Forty
William Forty
If you've ever tried to edit the widthfactor of mtext through VBA or VB.NET, you'll have realised that there isn't a method for doing so. However, there is a built in trick which bypasses the requirement for doing this. Try the code below:
Sub main()
Dim p As Variant
Dim mt As AcadMText
ThisDrawing.Utility.GetEntity mt, p, "Pick an MTEXT object..."
mt.TextString = "\W0.5;" & a.TextString
End Sub
Preceeding the TextString property with the prefix \W0.5; tells AutoCAD® to make all the text have a width factor of 0.5. You can also edit the width factor of individual parts of the TextString, by surrounding the text you want to change in curly brackets, as shown below.
Sub main()
Dim p As Variant
Dim mt As AcadMText
ThisDrawing.Utility.GetEntity mt, p, "Pick an MTEXT object..."
mt.TextString = "{\W0.5;narrow} {\W2;wide} {\W0.5;narrow} {\W2;wide} {\W0.5;narrow} {\W2;wide}"
End Sub
Hope this helps - if it did, please do subscribe to my blog. I'll be uploading many more tips and tricks regularly.
Comments
No comments