ModelCrosshairColor 属性 (ActiveX)
指定模型空间的十字准线和文本的颜色。 支持的平台:仅限 Windows 属性值只读:不 类型:OLE_COLOR(常量)
言论此属性的初始值为 。vbWhite 若要指定图纸空间布局的十字准线颜色,请使用该属性。LayoutCrosshairColor 例子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
可视化 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))))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-2 14:09
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.