ModelCrosshairColor Property (ActiveX)

Specifies the color of the crosshairs and text for model space.

Supported platforms: Windows only

Signature

VBA:

object.ModelCrosshairColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

Remarks

The initial value of this property is vbWhite.

To specify the crosshair color for the paper space layouts, use the LayoutCrosshairColor property.

Examples

VBA:

Sub Example_ModelCrossHairColor()
    ' This example returns the current setting of
    ' Model space CrossHairColor. It then changes the value, and
    ' finally resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currCrossHairColor As OLE_COLOR
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current CrossHairColor value
    currCrossHairColor = preferences.DISPLAY.ModelCrosshairColor
    MsgBox "The current value for the model space CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
    
    ' Change the value for CrossHairColor
    preferences.DISPLAY.ModelCrosshairColor = vbGreen
    MsgBox "The new value for CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
    
    ' Reset CrossHairColor to its original value
    preferences.DISPLAY.ModelCrosshairColor = currCrossHairColor
    MsgBox "The CrossHairColor value is reset to " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ModelCrossHairColor()
    ;; This example returns the current setting of
    ;; Model space CrossHairColor. It then changes the value, and
    ;; finally resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
  
    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))
    
    ;; Retrieve the current CrossHairColor value
    (setq currCrossHairColor (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The current value for the model space CrossHairColor is " (itoa (vlax-variant-value currCrossHairColor))))
    
    ;; Change the value for CrossHairColor
    (vla-put-ModelCrosshairColor ACADPref (vlax-make-variant acGreen 19))
    (setq newValue (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for CrossHairColor is " (itoa (vlax-variant-value newValue))))
    
    ;; Reset CrossHairColor to its original value
    (vla-put-ModelCrosshairColor ACADPref (vlax-variant-change-type currCrossHairColor 19)) 
    (alert (strcat "The CrossHairColor value is reset to " (itoa (vlax-variant-value currCrossHairColor))))
)