指定多行文本的间距。 支持的平台:仅窗口 属性值只读:不 类型:双 多行文本的间距。 言论MText:此属性中包含的值是“特性”选项板中的“线间距距离”属性。 例子工 务 局: Sub Example_LineSpacingDistance()
' This example creates an MText object, displays the value of the LineSpacingDistance property,
' changes the value of the property, and then resets the value to the original value.
Dim MTextObj As AcadMText
Dim width As Double
Dim text As String
Dim CurrentDistance As Double
Dim corner(0 To 2) As Double
corner(0) = 0
corner(1) = 10
corner(2) = 0
width = 10
text = "This is the text for the MText object"
' Creates the MText Object
Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
ZoomAll
' Find the current LineSpacingDistance
CurrentDistance = MTextObj.LineSpacingDistance
MsgBox "The LineSpacingDistance for the MText object is: " & CurrentDistance
' Change the LineSpacingDistance
MTextObj.LineSpacingDistance = 0.7
MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance
' Reset the LineSpacingDistance
MTextObj.LineSpacingDistance = CurrentDistance
MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_LineSpacingDistance()
;; This example creates an MText object, displays the value of the LineSpacingDistance property,
;; changes the value of the property, and then resets the value to the original value.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq corner (vlax-3d-point 0 10 0)
width 10
text "This is the text for the MText object")
;; Creates the MText Object
(setq modelSpace (vla-get-ModelSpace doc))
(setq MTextObj (vla-AddMText modelSpace corner width text))
(vla-ZoomAll acadObj)
;; Find the current LineSpacingDistance
(setq CurrentDistance (vla-get-LineSpacingDistance MTextObj))
(alert (strcat "The LineSpacingDistance for the MText object is: " (rtos CurrentDistance 2)))
;; Change the LineSpacingDistance
(vla-put-LineSpacingDistance MTextObj 0.7)
(alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))
;; Reset the LineSpacingDistance
(vla-put-LineSpacingDistance MTextObj CurrentDistance)
(alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:46
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.