CAD VBA修改背景颜色
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)
vbBlack
vbRed
vbYellow
vbGreen
vbCyan
vbBlue
vbMagenta
vbWhite
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
GetObjectIds to ObjectIdCollection
欢迎关注微信公众账号ByCAD