如何获取多行文字的当前对齐状态?
我现在有Proe导出的CAD文件,其中有部分文字的对齐状态需要更改。如:左上对齐的文字需更改为左中对齐,右上对齐的文字为右中对齐。找到了设置文字的对齐样式使用AttachmentPoint,但是获取当前的文字对齐方式怎么弄?求教!
摘自《明经通道 Auto CAD ActiveX 和VBA 参考》
Sub Example_AttachmentPoint()
Dim MTextObj As AcadMText
Dim width As Double
Dim text As String
Dim count As Integer
Dim attachPoint As String
Dim corner(0 To 2) As Double
corner(0) = 3#: corner(1) = 3#: corner(2) = 0#
width = 10
text = "Hello, World."
' Creates a MText object in model space
Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
For count = 1 To 9
MTextObj.AttachmentPoint = count
' Gets the attachment point of an MText object
attachPoint = Choose(MTextObj.AttachmentPoint, "TopLeft", "TopCenter", "TopRight", "MiddleLeft", "MiddleCenter", "MiddleRight", "BottomLeft", "BottomCenter", "BottomRight")
ThisDrawing.Regen True
MsgBox "The attachment point of the MText is now: " & attachPoint, vbInformation, "AttachmentPoint 示例"
Next
End Sub
wwswwswws 发表于 2015-1-12 09:57 static/image/common/back.gif
摘自《明经通道 Auto CAD ActiveX 和VBA 参考》
Sub Example_AttachmentPoint()
Dim MTextObj As Aca ...
。。。之前看了好几遍居然没看出来,我居然也从来没试过。谢谢啦!
页:
[1]