Alineaci髇 del texto de una l韓ea
From AutoCAD ActiveX
Puede justificar texto de línea horizontal y verticalmente. La alineación por defecto es la izquierda. Para establecer las opciones de alineación horizontal y vertical, utilice la propiedad Alignment.
Modificación de la alineación del texto
Este ejemplo crea un objeto Text y un objeto Point. El objeto Point se establece como el punto de alineación del texto y se cambia por un cursor en cruz rojo para que esté visible. Se cambia la alineación del texto y se muestra un cuadro de mensaje para indicar que la ejecución de la macro está detenida. Esto permite ver qué ocurre al cambiar la alineación del texto.
Sub Ch4_TextAlignment()
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
' Define the new Text objecttextString = "Hello, World."insertionPoint(0) = 3insertionPoint(1) = 3insertionPoint(2) = 0height = 0,5' Create the Text object in model spaceSet textObj = ThisDrawing.ModelSpace. _AddText(textString, insertionPoint, height)' Create a point over the text alignment point,' so we can better visualize the alignment processDim pointObj As AcadPointDim alignmentPoint(0 To 2) As DoublealignmentPoint(0) = 3alignmentPoint(1) = 3alignmentPoint(2) = 0Set pointObj = ThisDrawing.ModelSpace. _AddPoint(alignmentPoint)pointObj.Color = acRed' Set the point style to crosshairThisDrawing.SetVariable "PDMODE", 2' Align the text to the LefttextObj.Alignment = acAlignmentLeftThisDrawing.Regen acActiveViewportMsgBox "The Text object is now aligned left"' Align the text to the CentertextObj.Alignment = acAlignmentCenter' Align the text to the point (necessary for' all but left aligned text.)textObj.TextAlignmentPoint = alignmentPointThisDrawing.Regen acActiveViewportMsgBox "The Text object is now centered"' Align the text to the RighttextObj.Alignment = acAlignmentRightThisDrawing.Regen acActiveViewportMsgBox "The Text object is now aligned right"End Sub