CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

行距距离属性 (ActiveX)

2023-1-3 11:58| 发布者: admin| 查看: 498| 评论: 0|来自: AutoCAD

摘要: 指定多行文本的间距。

指定多行文本的间距。

支持的平台:仅窗口

签名

工 务 局:

object.LineSpacingDistance
对象

类型:地理位置标记MText

此属性适用的对象。

属性值

只读:

类型:

多行文本的间距。

言论

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)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 14:39

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部