TextFont プロパティ(ActiveX)

新しい文字のフォントを指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.TextFont
object

タイプ: PreferencesDisplay

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 文字列

新しいフォント名

注意

このプロパティの初期値は Courier です。

VBA:

Sub Example_TextFont()
    ' This example returns the current setting of
    ' TextFont. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currTextFont As String
    
    Set preferences = ThisDrawing.Application.Preferences
    
    ' Retrieve the current TextFont value
    currTextFont = preferences.Display.TextFont
    MsgBox "The current value for TextFont is " & preferences.Display.TextFont, vbInformation, "TextFont Example"
    
    ' Change the value for TextFont
    preferences.Display.TextFont = "TestTextFont"
    MsgBox "The new value for TextFont is " & preferences.Display.TextFont, vbInformation, "TextFont Example"
    
    ' Reset TextFont to its original value
    preferences.Display.TextFont = currTextFont
    MsgBox "The TextFont value is reset to " & preferences.Display.TextFont, vbInformation, "TextFont Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextFont()
    ;; This example returns the current setting of
    ;; TextFont. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Retrieve the current TextFont value
    (setq currTextFont (vla-get-TextFont (vla-get-Display preferences)))
    (alert (strcat "The current value for TextFont is " currTextFont))
    
    ;; Change the value for TextFont
    (vla-put-TextFont (vla-get-Display preferences) "TestTextFont")
    (alert (strcat "The new value for TextFont is " (vla-get-TextFont (vla-get-Display preferences))))
    
    ;; Reset TextFont to its original value
    (vla-put-TextFont (vla-get-Display preferences) currTextFont)
    (alert (strcat "The TextFont value is reset to " (vla-get-TextFont (vla-get-Display preferences))))
)