dchlmz 发表于 2006-5-9 15:00:00

<P>这幅图上的文字是垂直排列的单行文字。</P>
<P>可我就是不知道怎么做?</P>
<P>&nbsp;</P>

dchlmz 发表于 2006-5-9 15:01:00

<P>这幅图上的文字是垂直排列的单行文字。</P>
<P>可我就是不知道怎么做?</P>

dchlmz 发表于 2006-5-9 15:04:00

<P>图已经上传,如何用VBA实现单行文字垂直排列?</P>
<P>请各位高手帮忙,不胜感激。</P>

xinghesnak 发表于 2006-5-9 15:47:00

<P>问题已解决,应做如下设置</P>
<P>aa.StyleName = "Style-等线体(标准) V"</P>
<P>我没试出来是自己没用到过,楼主见谅啊。。。。。^_^</P>

dchlmz 发表于 2006-5-9 15:49:00

忘了上传形字体

dchlmz 发表于 2006-5-9 15:52:00

<P>忘了上传形字体</P>
<P></P>
<P>该怎么设置呀</P>
<P>aa.StyleName = "Style-等线体(标准) V"</P>
<P>aa是什么呀</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

xinghesnak 发表于 2006-5-9 15:56:00

<P>Sub main()<BR>Dim aa As Object<BR>Set aa = ThisDrawing.ModelSpace.Item(0)<BR>aa.StyleName = "Style-等线体(标准) V"<BR>End Sub</P>
<P>&nbsp;</P>

dchlmz 发表于 2006-5-9 16:08:00

<P>不行呀,显示不支持该方法aa.StyleName = "Style-等线体(标准) V"<BR></P>
<P>&nbsp;</P>

xinghesnak 发表于 2006-5-9 16:25:00

aa得到的是acadblock,你的程序是这样写的吗?

dchlmz 发表于 2006-5-9 16:33:00

<P>不是,我是新建图形,在原图中调用"Style-等线体(标准) V"字型,肯定能让字垂直排列。</P>
<P>我的源程序如下:请指正。</P>
<P>Sub main()<BR>&nbsp; Dim tsObj As AcadTextStyle<BR>&nbsp;&nbsp;&nbsp; Dim textobj As AcadText<BR>&nbsp;&nbsp;&nbsp; Dim textString As String<BR>&nbsp;&nbsp;&nbsp; Dim insPnt(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim agnPnt(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim Height As Double<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Set tsObj = ThisDrawing.TextStyles.Add("Style-等线体(标准) V")<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.ActiveTextStyle = tsObj<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; FontsName = "C:\AutoCAD 2002\Fonts\等线体(标准).shx"<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.ActiveTextStyle.fontFile = FontsName<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; FontsName = "C:\AutoCAD 2002\Fonts\等线体(标准)big.shx"<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.ActiveTextStyle.BigFontFile = FontsName<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Height = 1.5<BR>&nbsp;&nbsp;&nbsp; tsObj.Width = 1<BR>&nbsp;&nbsp;&nbsp; textString = "中华人民共和国"<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 'textobj.StyleName = "Style-等线体(标准) V"<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; insPnt(0) = 100: insPnt(1) = 50: insPnt(2) = 0<BR>&nbsp;&nbsp;&nbsp; Set textobj = ThisDrawing.ModelSpace.AddText(textString, insPnt, Height)<BR>&nbsp;&nbsp;&nbsp; 'textobj.Alignment = acAlignmentAligned<BR>&nbsp;&nbsp;&nbsp; 'textobj.VerticalAlignment = acVerticalAlignmentTop<BR>&nbsp;&nbsp;&nbsp; 'textobj.TextAlignmentPoint = insPnt<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ThisDrawing.Application.Update '更新数据<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.Application.ZoomExtents '全窗口</P>
<P>End Sub</P>
页: 1 [2] 3
查看完整版本: [VBA]单行文字的垂直排列