[讨论][求助]文字对齐方式
<P>以下是我在VBA开发时的文字录入的方法:</P><P>Function WZ(X0, Y0, AG1, TXT, TXTH, LAY1)<BR>'定义标注文字方式</P>
<P>On Error Resume Next<BR>Dim INP1(0 To 2) As Double<BR>INP1(0) = X0: INP1(1) = Y0: INP1(2) = 0<BR>Set OBJTXT = ThisDrawing.ModelSpace.AddText(TXT, INP1, TXTH)<BR>OBJTXT.StyleName = "DXT"<BR>OBJTXT.Layer = LAY1<BR>OBJTXT.Rotation = AG1<BR>Asc (Left(TXT, 1))<BR>If Asc(Left(TXT, 1)) >= 48 And Asc(Left(TXT, 1)) <= 90 Then<BR> XX = Len(TXT) * TXTH / 40 * SCAL * 0.71 / 4<BR>Else<BR> XX = (Len(TXT)) * TXTH / 40 * SCAL * 0.71 / 2<BR>End If<BR>If AG1 <> 0 Then<BR> INP1(0) = X0: INP1(1) = Y0 + XX: INP1(2) = 0<BR>Else<BR> INP1(0) = X0 + XX: INP1(1) = Y0 + TXTH / 2: INP1(2) = 0<BR>End If<BR>OBJTXT.Rotate INP1, RAG</P>
<P>End Function</P>
<P>当需要输入文字时,适用如下代码:</P>
<P>Call WZ(TKBASEX + 20.8 * SCAL, TKBASEY + 19.6 * SCAL, 3.14159 * (-0.5), "数 量", 2.5 * SCAL, "TK")</P>
<P>可是目前有一个问题:要将文字的对正方式跟改为“调整”,该怎么操作??此时该如何指定“文字对齐 坐标”和“位置 坐标”?</P> OBJTXT .Alignment = acAlignmentFit<BR>OBJTXT .TextAlignmentPoint = INP1 <P>谢谢!依照楼上的方法,问题解决了!</P> 非常不错的代码,谢谢分享。
页:
[1]