|
Sub addtext(ByVal X As Variant, ByVal Y As Variant, TextHeight As Double, textString As String)
Dim tsObj1 As AcadTextStyle
Set tsObj1 = ThisDrawing.TextStyles.Add("tsObj1")
ThisDrawing.ActiveTextStyle = tsObj1
Dim typeface1 As String
Dim bold1 As Boolean
Dim italic1 As Boolean
Dim charset1 As Long
Dim pitchandfamily1 As Long
Dim textObj As AcadText
typeface1 = "仿宋_GB2312"
bold1 = False
italic1 = False
charset1 = DEFAULT_CHARSET
pitchandfamily1 = FIXED_PITCH
tsObj1.SetFont typeface1, bold1, italic1, charset1, pitchandfamily1
tsObj1.height = 40
tsObj1.width = 0.75
Dim insPnt(0 To 2)
insPnt(0) = X: insPnt(1) = Y: insPnt(2) = 0
TextHeight = 100
Set textObj = ThisDrawing.ModelSpace.addtext(insPnt, TextHeight, textString)
textObj.StyleName = "tsObj1"
textObj.Update
End Sub
运行之后在Set textObj = ThisDrawing.ModelSpace.addtext(insPnt, TextHeight, textString) 的insPnt 提示我类型不匹配,我是初学者,请大家帮忙看看。
|
|