図形のテキスト文字列を指定します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.TextString
タイプ: Attribute、AttributeReference、GeoPositionMarker、MLeader、MLeaderStyle、MText、Text、Tolerance
このプロパティが適用されるオブジェクト。
読み込み専用: いいえ
タイプ: 文字列
長さは、最大で 256 文字です。
AttributeReference: AutoCAD での属性の値と同じです。
GeoPositionMarker、MText: テキスト文字列には、書式コードが含まれます。下線を引いたり、文字の上に線を引いたり、重ね文字を作成したりすることができます。色、フォント、文字の高さも変更できます。文字間を変更したり、文字幅を広げることができます。書式を適用したり、既存の文字列の書式を解析します。
VBA:
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))
)