qwh923820 发表于 2018-7-31 18:34:05

怎么修改字体

为什么这样修改标注样式字体是不行的,该怎么修改??
Private Sub Form_Load()
Dim newText As Object
Dim ys As Object,n&
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
    Err.Clear
    Set acadApp = CreateObject("AutoCAD.Application")
    If Err Then End
Else
    Set acadDoc = acadApp.Documents.Add
End If
acadApp.Visible = True
n = acadApp.Documents.Count
Set acadDoc = acadApp.Documents(n - 1)
Set ys = acadDoc.ActiveDimStyle
Set newText = acadDoc.TextStyles
newText.Item(1).Name = "宋体"
End Sub


cabinsummer 发表于 2018-8-3 13:21:42

试试这样行不行

qwh923820 发表于 2018-8-3 17:34:19

cabinsummer 发表于 2018-8-3 13:21
试试这样行不行

谢谢,已解决,引用@zzyong00的办法

cad用单线字体好一点,字多也速度快
'创建新的字体样式
Public Sub NewTextStyle2()   '创建新的字体样式,gbenor.SHX gbcbig.SHX 字体
    On Error GoTo err1
    Dim lkxtextstyle As AcadTextStyle
    Set lkxtextstyle = ThisDrawing.TextStyles.Add("ZZY_2")
    With lkxtextstyle
      .fontFile = "gbenor.SHX"
      .BigFontFile = "gbcbig.SHX"
      .Width = 0.85
    End With
    Exit Sub
err1:
    Err.Clear
    Resume Next
End Sub

oistre 发表于 2018-8-8 13:17:25

下载试试,谢谢源码!

wojiaohuyong 发表于 2024-7-30 14:33:53

谢谢源码!
页: [1]
查看完整版本: 怎么修改字体