属性、属性参照、または文字の垂直位置合わせと水平位置合わせの両方を指定します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: いいえ
タイプ: acAlignment 列挙型
acAlignmentLeft で位置合わせされる文字は、InsertionPoint プロパティを使用して文字を位置付けます。
acAlignmentAligned または acAlignmentFit で位置合わせされる文字は、InsertPoint と TextAlignmentPoint の両方のプロパティを使用して文字を位置付けます。
これら以外の位置で位置合わせされる文字は、TextAlignmentPoint プロパティを使用して文字を位置付けます。
VBA:
Sub Example_Alignment() ' This example creates a text object in model space and ' demonstrates setting the alignment of the new text string Dim textObj As AcadText Dim textString As String Dim insertionPoint(0 To 2) As Double, alignmentPoint(0 To 2) As Double Dim height As Double Dim oldPDMODE As Integer Dim pointObj As AcadPoint ' Define the new Text object textString = "Hello, World." insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0 alignmentPoint(0) = 3: alignmentPoint(1) = 3: alignmentPoint(2) = 0 height = 0.5 ' Create the Text object in model space Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height) oldPDMODE = ThisDrawing.GetVariable("PDMODE") ' Record existing point style ' Create a crosshair over the text alignment point ' to better visualize the alignment process Set pointObj = ThisDrawing.ModelSpace.AddPoint(alignmentPoint) ThisDrawing.SetVariable "PDMODE", 2 ' Set point style to crosshair ThisDrawing.Application.ZoomAll ' Set the text alignment to a value other than acAlignmentLeft, which is the default. ' Create a point that will act as an alignment reference point textObj.Alignment = acAlignmentRight ' Create the text alignment reference point and the text will automatically ' align to the right of this point, because the text ' alignment was set to acAlignmentRight textObj.TextAlignmentPoint = alignmentPoint ThisDrawing.Regen acActiveViewport MsgBox "The Text object is now aligned to the right of the alignment point" ' Center the text to the alignment point textObj.Alignment = acAlignmentCenter ThisDrawing.Regen acActiveViewport MsgBox "The Text object is now centered to the alignment point" ' Reset point style ThisDrawing.SetVariable "PDMODE", oldPDMODE End Sub
Visual LISP:
(vl-load-com) (defun c:Example_Alignment() ;; This example creates a text object in model space and ;; demonstrates setting the alignment of the new text string (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the new Text object (setq insertionPoint (vlax-3d-point 3 3 0) alignmentPoint (vlax-3d-point 3 3 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)) (setq oldPDMODE (vlax-variant-value (vla-GetVariable doc "PDMODE"))) ;; Record existing point style ;; Create a crosshair over the text alignment point ;; to better visualize the alignment process (setq pointObj (vla-AddPoint modelSpace alignmentPoint)) (vla-SetVariable doc "PDMODE" 2) ;; Set point style to crosshair (vla-ZoomAll acadObj) ;; Set the text alignment to a value other than acAlignmentLeft, which is the default. ;; Create a point that will act as an alignment reference point (vla-put-Alignment textObj acAlignmentRight) ;; Create the text alignment reference point and the text will automatically ;; align to the right of this point, because the text ;; alignment was set to acAlignmentRight (vla-put-TextAlignmentPoint textObj alignmentPoint) (vla-Regen doc acActiveViewport) (alert "The Text object is now aligned to the right of the alignment point.") ;; Center the text to the alignment point (vla-put-Alignment textObj acAlignmentCenter) (vla-Regen doc acActiveViewport) (alert "The Text object is now centered to the alignment point.") ;; Reset point style (vla-SetVariable doc "PDMODE" oldPDMODE) )