CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

行距样式属性 (ActiveX)

2023-1-3 12:02| 发布者: admin| 查看: 420| 评论: 0|来自: AutoCAD

摘要: 指定 MText 对象的行距样式。

指定 MText 对象的行距样式。

支持的平台:仅窗口

签名

工 务 局:

object.LineSpacingStyle
对象

类型:地理位置标记MText

此属性适用的对象。

属性值

只读:

类型:枚举acLineSpacingStyle

  • acLineSpacingStyleAtLeast
  • acLineSpacingStyleExactly

言论

该设置允许根据文本行中最大字符的高度自动调整不同文本行之间的间距。该设置强制对象中所有行的行间距为相同的大小,而不考虑格式覆盖。acLineSpacingStyleAtLeastacLineSpacingStyleExactlyMText

例子

工 务 局:

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

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

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 07:53

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部