AltFontFile 示例

使用 VBA 以外的其它编程语言

Sub Example_AltFontFile()
    ' This example returns the current setting of
    ' AltFontFile. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currAltFontFile As String
    Dim newAltFontFile As String
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current AltFontFile value
    currAltFontFile = preferences.Files.AltFontFile
    MsgBox "The current value for AltFontFile is " & currAltFontFile, vbInformation, "AltFontFile 示例"
    
    ' Change the value for AltFontFile
    newAltFontFile = "C:/AutoCAD/Fonts/gothice.shx"
    preferences.Files.AltFontFile = newAltFontFile
    MsgBox "The new value for AltFontFile is " & newAltFontFile, vbInformation, "AltFontFile 示例"
    
    ' Reset AltFontFile to its original value
    preferences.Files.AltFontFile = currAltFontFile
    MsgBox "The AltFontFile value is reset to " & currAltFontFile, vbInformation, "AltFontFile 示例"
 End Sub