指定实体的文本字符串。 支持的平台:仅窗口 属性值只读:不 类型:字符串 最大长度为 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)) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:17
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.