UpdateMTextAttribute メソッド(ActiveX)

マルチ テキストから属性を、および属性からマルチ テキストを更新します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.UpdateMTextAttribute
object

タイプ: Attribute

このメソッドが適用されるオブジェクト。

戻り値(RetVal)

戻り値はありません。

注意

追加の注意はありません。

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties
    
    Dim attributeObj As IAcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String
    
    ' Define the attribute definition
    height = 1.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"
    
    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    
    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0) 
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")
    
    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    
    (vla-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)