LineSpacingFactor 属性 (ActiveX)
指定 MText 对象的相对行距系数。 支持的平台:仅限 Windows 属性值只读:不 类型:双 对象的相对行距系数。输入一个介于 0.25 和 4(含 0.25 和 4)之间的值。MText 言论间距系数是一行文本的基线与下一行文本行的基线之间的垂直距离。间距系数设置为单行间距的倍数。 可以使用该属性将行距设置为“至少”指定距离或“完全”指定距离。LineSpacingStyle 例子VBA: Sub Example_LineSpacingFactor()
' This example creates an MText object in model space
' and then finds the LineSpacingFactor for the object.
Dim MTextObj As AcadMText
Dim corner(0 To 2) As Double
Dim width As Double
Dim text As String
corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
width = 10
text = "This is the text String for the mtext Object"
' Creates the MText Object
Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
ZoomAll
' Find the current LineSpacingFactor
Dim currFactor As Double
currFactor = MTextObj.LineSpacingFactor
MsgBox "The LineSpacingFactor for the MText object is: " & currFactor
' Change the LineSpacingFactor
MTextObj.LineSpacingFactor = 4
MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor
' Reset the LineSpacingFactor
MTextObj.LineSpacingFactor = currFactor
MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_LineSpacingFactor()
;; This example creates an MText object in model space
;; and then finds the LineSpacingFactor for the object.
(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 String 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 LineSpacingFactor
(setq currFactor (vla-get-LineSpacingFactor MTextObj))
(alert (strcat "The LineSpacingFactor for the MText object is: " (rtos currFactor 2)))
;; Change the LineSpacingFactor
(vla-put-LineSpacingFactor MTextObj 0.7)
(alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))
;; Reset the LineSpacingFactor
(vla-put-LineSpacingFactor MTextObj currFactor)
(alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 22:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.