同样使用多行文字,且字高一样,结果为什么不同
<P>各位专家:你们好!</P><P> 我定义了一个多行文字的样式,多次调用该多行文字生成相关内容,但文字的高度为什么不一致,是CAD出毛病了吗?我用的是CAD2004</P>
<P>程序部分代码如下:</P>
<P> Dim cad1 As Object 'AutoCAD对象<BR> Dim cad2 As Object 'AutoCAD当前绘图模型区对象<BR> Dim CADobj1 As Object, CADobj2 As Object, CADobj3 As Object '定义备用的三个CAD对象<BR> Dim CADpoint1(3) As Double, CADpoint2(3) As Double, CADpoint3(3) As Double, CADpoint4(3) As Double '定义备用的三个点变量 必须只能是数据型的<BR> Dim eg0point5(6) As Double '缓和曲线起终点坐标<BR> Dim Ppt1(3) As Double, Ppt2(3) As Double, Ppt3(3) As Double, Pptcen(3) As Double, Ppt3R As Double, AngS As Double, AngE As Double '已知三点求圆弧参数<BR> Set cad1 = CreateObject("autOcad.application")<BR> Set cad2 = cad1.ActiveDocument: cad1.ActiveDocument.Utility.InitializeUserInput 1 '该句命令使CAD接收VB的命令,并将在CAD中的输入传入VB的变量中<BR> <BR> Dim txtMODE As AcadTextStyle '定义mytxt变量为文本样式<BR> Dim ddmmss As String, i As Long, j As Long<BR> Dim mh As Integer, zh As Integer, dh As Integer<BR> Dim dxks As String, dxke As String, lcjsdkkm As String, nowdk As String, lcjskm As String<BR> Dim dldlcs As Double, dldlce As Double, dlznow As Double, t1 As Double, t2 As Double<BR> Dim lcjsk As Long, lcjsm As Double<BR> Dim xhy As Double, yhy As Double, xyh As Double, yyh As Double<BR> <BR> Set txtMODE = cad2.TextStyles.Add("txtMODE") '建立以名为 txtMODE 的文字样式<BR> txtMODE.fontFile = "c:\windows\fonts\simfang.ttf" '设置字体文件为仿宋体<BR> txtMODE.Height = 5000 '字高<BR> txtMODE.Width = 0.8 '宽高比<BR> txtMODE.ObliqueAngle = cad2.Utility.AngleToReal(0, 0) '倾斜角度(需转为弧度)<BR> cad2.ActiveTextStyle = txtMODE '将当前文字样式设置为mytxt</P>
<P>Set CADobj2 = cad2.ModelSpace.AddMText(CADpoint1, 150, jdmnow) '写字</P>
<P>Set CADobj2 = cad2.ModelSpace.AddMText(CADpoint1, 350, "\H 15" + dxks): CADobj2.AttachmentPoint = 2 '居中 1_靠左,3_靠右</P>
<P>Set CADobj2 = cad2.ModelSpace.AddMText(CADpoint1, 200, "\H 15" + jdmnow): CADobj2.AttachmentPoint = 2 '居中 1_靠左,3_靠右<BR></P>
<P>Set CADobj2 = cad2.ModelSpace.AddMText(CADpoint1, 200, "\H 15" + jdmnow): CADobj2.AttachmentPoint = 2 '居中 1_靠左,3_靠右</P>
<P> 附:程序多次调用生成的线路图,其中大的文字是不的。我不知道原因在哪,请专家解答。谢谢</P> ,专家们 :肯请得到你们的帮助。会者不难。再次谢谢 其实问题很简单,( CADobj2.AttachmentPoint = 2'居中 1_靠左,3_靠右 )这句话是将文字在宽度方向上居中,由于你的文字宽度不同,所以文字居中的位置不一样。当然高度就不一样了。。。。。
页:
[1]