明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1498|回复: 2

请大家帮我一下,是关于文本对齐方面的问题

[复制链接]
发表于 2003-5-2 18:28 | 显示全部楼层 |阅读模式
比如我选了几个文本,我要设置它们的acalignmentmiddleleft 中的X坐标的相同(这一步我能解决),而Y坐标不变(这就有麻烦了),我不知道怎样把原来文本的y坐标调用出来
  我本来是这样写的
   dim oldpt as Variant
   dim nept(0 to 2) as double
   oldpt=ent.ent.TextAlignmentPoint
   nept(1)=oldpt(1)
  “ent是已选中的单行文本”
这样做行不通,请大家帮一下我
发表于 2003-5-2 19:34 | 显示全部楼层

帮助中已经说明,如果对齐方式为acAlignmentLeft时,对齐点的坐标值为0

所以在改变对齐方式后,应该把插入点重新设回原来的插入点,不然文字就会跑到原点上 去。

以下程序你试试:

  1. Sub TextAlignPnt()
  2. Dim pnt As Variant
  3. Dim pnt1 As Variant
  4. Dim pnt2 As Variant
  5. Dim obj As AcadEntity
  6. Dim txt As AcadText
  7. ThisDrawing.Utility.GetEntity obj, pnt1, "Select Text:"
  8. If obj.ObjectName = "AcDbText" Then
  9.     Set txt = obj
  10.     pnt = txt.InsertionPoint
  11.     Debug.Print "Insertionpoint=" & pnt(0) & " " & pnt(1) & " "; pnt(2)
  12.     txt.Alignment = acAlignmentMiddleLeft
  13.     pnt1 = txt.TextAlignmentPoint
  14.     txt.InsertionPoint = pnt
  15.     Debug.Print "Alignmentpoint=" & pnt1(0) & " " & pnt1(1) & " "; pnt1(2)

  16. pnt2 = ThisDrawing.Utility.GetPoint(, "Select New Alignment point:")
  17.     Debug.Print "Selectpoint=" & pnt2(0) & " " & pnt2(1) & " "; pnt2(2)
  18.     pnt1(0) = pnt2(0)
  19.     txt.TextAlignmentPoint = pnt1
  20.     ThisDrawing.Application.Update
  21. End If
  22. End Sub
 楼主| 发表于 2003-5-2 21:51 | 显示全部楼层

谢谢

让我先试一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 19:30 , Processed in 0.190247 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表