CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

文本字符串属性 (ActiveX)

2023-1-3 03:38| 发布者: admin| 查看: 267| 评论: 0|来自: AutoCAD

摘要: 指定实体的文本字符串。

指定实体的文本字符串。

支持的平台:仅窗口

签名

工 务 局:

object.TextString
对象

类型:属性,属性引用地理位置标记,MLeader,MLeaderStyleMText文本容差

此属性适用的对象。

属性值

只读:

类型:字符串

最大长度为 256 个字符。

言论

属性引用:这等效于 AutoCAD 中属性的值。

GeoPositionMarker,MText:文本字符串可能包含格式代码。您可以添加下划线、在文本上添加线条以及创建堆叠文本。您还可以更改颜色、字体和文本高度。您可以更改文本字符之间的空格或增加字符本身的宽度。应用格式,或分析现有文本字符串的格式。

例子

工 务 局:

Sub Example_TextString()
    ' This example creates a text object in model space.
    ' It then returns the text string for that object.
    
    Dim textObj As AcadText
    Dim text As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    
    ' Define the text object
    text = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5
    
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)
    ZoomAll
    
    ' Return the current text string for the object
    text = textObj.textString
    MsgBox "The TextString property equals: " & text, vbInformation, "TextString Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextString()
    ;; This example creates a text object in model space.
    ;; It then returns the text string for that object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 2 2 0)
          textString "Hello, World."
          height 0.5)
    
    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)
    
    ;; Return the current text string for the object
    (setq text (vla-get-TextString textObj))
    (alert (strcat "The TextString property equals: " text))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部