明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1198|回复: 1

疑似bug

[复制链接]
发表于 2007-3-9 20:36:00 | 显示全部楼层 |阅读模式

各位领导:

附件是一段AutoCAD2004帮助文件中的例子。打开附件可见一行中文说明,即是我发现的问题,恳请各位赐教。

这个例子是个VBA程序,讲解TextAlignment是如何工作的,然而当我改变文字的插入点为(0,0)是,程序居然得不到预期结果。这可是官方例子啊!

先谢了!

 楼主| 发表于 2007-3-10 20:28:00 | 显示全部楼层

咋没看到附件?

Sub Example_TextAlignmentPoint()
    ' This example creates a text object in model space.
    ' It then changes the TextAlignmentPoint and HorizontalAlignment
    ' properties of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
   
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    '如果把上一行的两个坐标值3和3都改为0,则修改对齐方式后的文本就显示不出来
    height = 0.5
   
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The TextAlignmentPoint is set to the default " & textObj.TextAlignmentPoint(0) & ", " & textObj.TextAlignmentPoint(1) & ", " & textObj.TextAlignmentPoint(2), vbInformation, "TextAlignmentPoint Example"
   
    ' Change the value of the HorizontalAlignment and
    ' TextAlignmentPoint properties.
    ' Note that the HorizontalAlignment property must be changed first,
    ' and to a value that requires the TextAlignmentPoint, before the
    ' TextAlignmentPoint property will allow a value to be set.
    Dim alignmentPoint(0 To 2) As Double
    alignmentPoint(0) = 5: alignmentPoint(1) = 3: alignmentPoint(2) = 0
    textObj.HorizontalAlignment = acHorizontalAlignmentFit
    textObj.TextAlignmentPoint = alignmentPoint
    ZoomAll
    MsgBox "The TextAlignmentPoint is set to " & textObj.TextAlignmentPoint(0) & ", " & textObj.TextAlignmentPoint(1) & ", " & textObj.TextAlignmentPoint(2) & vbCrLf & "The HorizontalAlignment is set to acHorizontalAlignmentFit", vbInformation, "TextAlignmentPoint Example"
   
End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-2-22 18:50 , Processed in 0.242136 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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