







Description
Property type
Syntax
Visual Basic |
---|
Public Property color As color |
Remarks
Colors can be set and read as numeric index values ranging from 0 to 256. For the standard seven colors and the ByBlock and ByLayer designations, you can also use constants shown below. The default color designation is ByLayer (0).
Example
Private Sub ColorExample()
'This example demonstrates how to return and change the Color property.
Dim ents As Object
Dim ent As IntelliCAD.Entity
Dim NewColor As Integer
Dim Response
Dim ct As Long
Dim x As Long
Set ents = ActiveDocument.ModelSpace
ct = ents.Count
MsgBox "No. of entities = " & ct
For x = 0 To ct - 1
Set ent = ents.Item(x)
Response = MsgBox("Color of entity is: " & ent.color.ColorIndex & Chr(13) & "Do you want to change it?", vbYesNo, "Color of Entities")
If Response = vbYes Then
NewColor = InputBox("New color [0-256]:")
Dim color As IntelliCAD.color
Set color = ent.color
color.ColorMethod = vicColorMethodByACI
color.ColorIndex = NewColor
ent.color = color
ent.Update
End If
' Display message.
Response = MsgBox("Continue listing entities?", vbYesNo, "Color of Entities")
If Response = vbNo Then GoTo Regener
Next x
Regener:
ThisDocument.Regen
End
End Sub