- 积分
- 532
- 明经币
- 个
- 注册时间
- 2003-9-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2003-11-3 10:11:00
|
显示全部楼层
有问题的代码如下:
Dim strText As String
Dim oEntity As AcadEntity
Dim oText As AcadText
Dim bFound As Boolean
Dim typeFace As String
Dim Bold As Boolean
Dim Italic As Boolean
Dim charSet As Long
Dim PitchandFamily As Long
Dim minPoint As Variant, maxpoint As Variant
Dim InsertPoint(2) As Double
Dim height As Double
strText = InputBox("请输入需要查找的文字!")
bFound = False
For Each oEntity In oDoc.ModelSpace
If oEntity.ObjectName = "AcDbText" Then
Set oText = oDoc.ModelSpace.Item(i)
DoEvents
If LCase(oText.TextString) = strText Then
oText.GetBoundingBox minPoint, maxpoint
height = 1
InsertPoint(0) = maxPoint(0) + 5
InsertPoint(1) = maxPoint(1) - (height + 5)
InsertPoint(2) = maxPoint(2)
oDoc.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily
oDoc.ActiveTextStyle.SetFont "宋体", False, False, charSet, PitchandFamily
Set oText = oDoc.ModelSpace.AddText("朱震宇", InsertPoint, height)
oText.Update
End If
End If
DoEvents
i = i + 1
Next
MsgBox "OK!"
'关键是oText.GetBoundingBox minPoint, maxpoint这句话出错。 |
|