yxr_MJTD 发表于 2008-12-20 13:27:00

关二字体

<p>请问怎样才能在CAD中为一个新建的样式名的字体改为"黑体"???用VBA代码.谢谢各位!!!</p>

dylanjyu 发表于 2012-12-25 17:54:42

我也想知道啊,今天研究了好久,下面是网上找到的一段代码
Sub ModifyTextFont()
    Dim typeFace As String
    Dim SavetypeFace As String
    Dim Bold As Boolean
    Dim Italic As Boolean
    Dim charSet As Long
    Dim PitchandFamily As Long

    ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily

    typeFace = "黑体"
    ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
    ThisDrawing.Regen acActiveViewport

End Sub

以上代码,但是发现运行不完美,要HZ字体样式才能显示到效果,但是“样式”那里仍然不会显示为“黑体”,并且standard等不会显示效果

dylanjyu 发表于 2012-12-25 17:55:56

楼主知道方法了吗?知道的话麻烦告诉我一声,谢谢
页: [1]
查看完整版本: 关二字体