GraphicsWinModelBackgrndColor 属性 (ActiveX) 
指定模型空间窗口的背景色。 支持的平台:仅限 Windows 属性值只读:不 类型:OLE_COLOR(常量) 
 言论此属性的默认颜色为 。vbBlack 例子VBA: Sub Example_GraphicsWinModelBackgrndColor()
    ' This example returns the current setting of
    ' GraphicsWinModelBackgrndColor. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currGraphicsWinModelBackgrndColor As OLE_COLOR
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current GraphicsWinModelBackgrndColor value
    currGraphicsWinModelBackgrndColor = preferences.DISPLAY.GraphicsWinModelBackgrndColor
    MsgBox "The current value for GraphicsWinModelBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"
    
    ' Change the value for GraphicsWinModelBackgrndColor
    preferences.DISPLAY.GraphicsWinModelBackgrndColor = 16
    MsgBox "The new value for GraphicsWinModelBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"
    
    ' Reset GraphicsWinModelBackgrndColor to its original value
    preferences.DISPLAY.GraphicsWinModelBackgrndColor = currGraphicsWinModelBackgrndColor
    MsgBox "The GraphicsWinModelBackgrndColor value is reset to " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_GraphicsWinModelBackgrndColor()
    ;; This example returns the current setting of
    ;; GraphicsWinModelBackgrndColor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))
        
    ;; Retrieve the current GraphicsWinModelBackgrndColor value
    (setq currGraphicsWinModelBackgrndColor (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor (vla-get-Display preferences)) vlax-vbLong))
    (alert (strcat "The current value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))
    
    ;; Change the value for GraphicsWinModelBackgrndColor
    (vla-put-GraphicsWinModelBackgrndColor ACADPref (vlax-make-variant 127 19))
    (setq newValue (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value newValue))))
    
    ;; Reset GraphicsWinModelBackgrndColor to its original value
    (vla-put-GraphicsWinModelBackgrndColor ACADPref currGraphicsWinModelBackgrndColor)
    (alert (strcat "The GraphicsWinModelBackgrndColor value is reset to " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 20:14
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.