兰州人 发表于 2008-6-24 20:41:00

ThisDrawing.ActiveTextStyle.fontFile 的用法

在对ActiveTextStyle的应用要比VBA的帮助文件更容易理解.
如,ThisDrawing.ActiveTextStyle.fontFile = "c:\windows\fonts\simsun.ttf"
帮助文件就比较麻烦了.
Sub Example_ActiveTextStyle()
    ' This example returns the current text style
    ' and then sets a new style.
    ' Finally, it returns the style to the previous setting.
    Dim newTextStyle As AcadTextStyle
    Dim currTextStyle As AcadTextStyle
   
    ' Return current text style of active document
    Set currTextStyle = ThisDrawing.ActiveTextStyle
    MsgBox "The current text style is " & currTextStyle.name, vbInformation, "ActiveTextStyle Example"
   
    ' Create a text style and make it current
    Set newTextStyle = ThisDrawing.TextStyles.Add("TestTextStyle")
    ThisDrawing.ActiveTextStyle = newTextStyle
    MsgBox "The new text style is " & newTextStyle.name, vbInformation, "ActiveTextStyle Example"
   
    ' Reset the text style to its previous setting
    ThisDrawing.ActiveTextStyle = currTextStyle
    MsgBox "The text style is reset to " & currTextStyle.name, vbInformation, "ActiveTextStyle Example"
End Sub**** Hidden Message *****

robbin840311 发表于 2008-6-25 08:29:00

路过,学习,谢谢兰州人
页: [1]
查看完整版本: ThisDrawing.ActiveTextStyle.fontFile 的用法