How does the Color.FromColorIndex work?

How does the Color.FromColorIndex work?

ilovejingle
Enthusiast Enthusiast
1,404 Views
1 Reply
Message 1 of 2

How does the Color.FromColorIndex work?

ilovejingle
Enthusiast
Enthusiast
attDef.Color = Color.FromColorIndex(ColorMethod.ByBlock, 1);

I found this code works for changing the entity's color. 

I know in AutoCAD we have 0 to 256 index colors where 0 should be byblock and 256 should be bylayer. but what the two parameters in this method actually mean?

0 Likes
1,405 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant

With ColorMethod.ByBlock or ColorMethod.ByLayer the 2 parameter are redondants.

For indexed colors, you should ue: ColorMethod.ByAci.

Or simpler, use the Entity.ColorIndex property instaed of Entity.Color.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes