Dim myTxtobj As AcadTextStyle Set mytxt = ThisDrawing.TextStyles.Add("mytxt") '添加mytxt样式 mytxt.f '设置字体文件为仿宋体 mytxt.Height = 0 '字高 mytxt.width = 0.7 '宽高比 mytxt.ObliqueAngle = ThisDrawing.Utility.AngleToReal(0, 0) '倾斜角度(需转为弧度) ThisDrawing.ActiveTextStyle = mytxt '将当前文字样式设置为mytxt Set txtobj = ThisDrawing.ModelSpace.AddMText(p, 1400, "{做到老,学到老}\P" & "此心自光明正大,过人远矣") txtobj.LineSpacingFactor = 2 '指定行间距 txtobj.AttachmentPoint = 3 '右对齐(1为左对齐,2为居中)
从VBA初级教程上摘录的,希望有所帮助。 |