VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Color Index on UserForm

2 REPLIES 2
Reply
Message 1 of 3
Gordough
1649 Views, 2 Replies

Color Index on UserForm

Does anyone know how to determine where the user clicked his mouse on a userform. I want to add an image of the AutoCAD color index to a userform. I need to know where the user clicked to determine which color box was selected.

Is there a better way to do this or is it possible to publicly access the AutoCAD color control from VBA?
2 REPLIES 2
Message 2 of 3
rocheey
in reply to: Gordough

Check out the MouseDown or MouseUp events for the form, or control, that you are placing the image(s) on
Message 3 of 3
Gordough
in reply to: Gordough


Thanx. I figured that one out recently.

Do you know how to set a color of a layer using the aci index number? As far as I can tell the only way is to use the SetRGB method of an AcadacCmColor object. Is there an easy way of determining or relating the ACI number to the RGB values? I can get the colorindex property of a layer but I can't set the color index property as far as I can tell.

Dim oLayers As AcadLayers
Dim oldColor As AcadAcCmColor
Dim olayCol As Integer
Dim newColor As Integer

Set oLayers = ThisDrawing.Layers 'current document layers collection
newColor = 4
Dim I As Integer

For I = 0 To ThisDrawing.Layers.Count - 1
Set oldColor = oLayers.Item(I).TrueColor
olayCol = oldColor.ColorIndex
If newColor = olayCol Then
MsgBox "The new color:" & newColor & " matches the old layer color: " & olayCol
'I want to change the old layer color here.
End If
Next I

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost