jxliu 发表于 2007-3-9 20:36:00

疑似bug

<p>各位领导:</p><p>附件是一段AutoCAD2004帮助文件中的例子。打开附件可见一行中文说明,即是我发现的问题,恳请各位赐教。</p><p>这个例子是个VBA程序,讲解TextAlignment是如何工作的,然而当我改变文字的插入点为(0,0)是,程序居然得不到预期结果。这可是官方例子啊!</p><p>先谢了!</p>

jxliu 发表于 2007-3-10 20:28:00

<p>咋没看到附件?</p><p>Sub Example_TextAlignmentPoint()<br/>&nbsp;&nbsp;&nbsp; ' This example creates a text object in model space.<br/>&nbsp;&nbsp;&nbsp; ' It then changes the TextAlignmentPoint and HorizontalAlignment<br/>&nbsp;&nbsp;&nbsp; ' properties of the text object.</p><p>&nbsp;&nbsp;&nbsp; Dim textObj As AcadText<br/>&nbsp;&nbsp;&nbsp; Dim textString As String<br/>&nbsp;&nbsp;&nbsp; Dim insertionPoint(0 To 2) As Double<br/>&nbsp;&nbsp;&nbsp; Dim height As Double<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' Define the text object<br/>&nbsp;&nbsp;&nbsp; textString = "Hello, World."<br/>&nbsp;&nbsp;&nbsp; insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0<br/>&nbsp;&nbsp;&nbsp; '如果把上一行的两个坐标值3和3都改为0,则修改对齐方式后的文本就显示不出来<br/>&nbsp;&nbsp;&nbsp; height = 0.5<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' Create the text object in model space<br/>&nbsp;&nbsp;&nbsp; Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)<br/>&nbsp;&nbsp;&nbsp; ZoomAll<br/>&nbsp;&nbsp;&nbsp; MsgBox "The TextAlignmentPoint is set to the default " &amp; textObj.TextAlignmentPoint(0) &amp; ", " &amp; textObj.TextAlignmentPoint(1) &amp; ", " &amp; textObj.TextAlignmentPoint(2), vbInformation, "TextAlignmentPoint Example"<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' Change the value of the HorizontalAlignment and<br/>&nbsp;&nbsp;&nbsp; ' TextAlignmentPoint properties.<br/>&nbsp;&nbsp;&nbsp; ' Note that the HorizontalAlignment property must be changed first,<br/>&nbsp;&nbsp;&nbsp; ' and to a value that requires the TextAlignmentPoint, before the<br/>&nbsp;&nbsp;&nbsp; ' TextAlignmentPoint property will allow a value to be set.<br/>&nbsp;&nbsp;&nbsp; Dim alignmentPoint(0 To 2) As Double<br/>&nbsp;&nbsp;&nbsp; alignmentPoint(0) = 5: alignmentPoint(1) = 3: alignmentPoint(2) = 0<br/>&nbsp;&nbsp;&nbsp; textObj.HorizontalAlignment = acHorizontalAlignmentFit<br/>&nbsp;&nbsp;&nbsp; textObj.TextAlignmentPoint = alignmentPoint<br/>&nbsp;&nbsp;&nbsp; ZoomAll<br/>&nbsp;&nbsp;&nbsp; MsgBox "The TextAlignmentPoint is set to " &amp; textObj.TextAlignmentPoint(0) &amp; ", " &amp; textObj.TextAlignmentPoint(1) &amp; ", " &amp; textObj.TextAlignmentPoint(2) &amp; vbCrLf &amp; "The HorizontalAlignment is set to acHorizontalAlignmentFit", vbInformation, "TextAlignmentPoint Example"<br/>&nbsp;&nbsp;&nbsp; <br/>End Sub<br/></p>
页: [1]
查看完整版本: 疑似bug