兰州人 发表于 2008-9-26 16:44:00

文本对齐

<p>以X坐标一点中心对齐 X=775,y坐标提取就是.InsertionPoint(1)</p><p>如pp(0) = 775: pp(1) = .InsertionPoint(1): pp(2) = 0<br/>程序如下:</p><p>Sub ls()<br/>&nbsp;Dim objText As AcadText, Ent As AcadEntity<br/>&nbsp;Dim pp(0 To 2) As Double ', alignmentPoint(0 To 2) As Double<br/>&nbsp;For Each Ent In ThisDrawing.ModelSpace<br/>&nbsp;&nbsp; Set objText = Ent<br/>&nbsp;&nbsp; With objText<br/>&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; pp(0) = 775: pp(1) = .InsertionPoint(1): pp(2) = 0<br/>&nbsp;&nbsp;&nbsp;&nbsp; 'alignmentPoint(0) = 775: alignmentPoint(1) = .InsertionPoint(1): alignmentPoint(2) = 0<br/>&nbsp;&nbsp;&nbsp;&nbsp; 'Debug.Print .InsertionPoint(1), .TextString<br/>&nbsp;&nbsp;&nbsp;&nbsp; For jj = 0 To 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print .InsertionPoint(jj), pp(jj)<br/>&nbsp;&nbsp;&nbsp;&nbsp; Next jj<br/>&nbsp;&nbsp;&nbsp;&nbsp; .Alignment = acAlignmentCenter<br/>&nbsp;&nbsp;&nbsp;&nbsp; .TextAlignmentPoint = pp 'alignmentPoint<br/>&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp; End With<br/>&nbsp;Next<br/>End Sub<br/></p>
页: [1]
查看完整版本: 文本对齐