By Joe Ye
Issue
How can I change the color of an annotation symbol through Revit API?
Solution
View.ProjColorOverrideByElement can be used to change a set of individual elements' color in the caller view.Here is the code fragment to change selected annotation in active view.
UIApplication uiApp = commandData.Application;
Application app = uiApp.Application;
Document doc = uiApp.ActiveUIDocument.Document;
Color color = app.Create.NewColor();
color.Blue = (byte)150;
color.Red = (byte)200;
color.Green = (byte)200;
Selection sel = uiApp.ActiveUIDocument.Selection;
Reference ref1 = sel.PickObject(ObjectType.Element,
"Pick an Annotation");
Element elem = ref1.Element;
List<ElementId> ids = new List<ElementId>();
ids.Add(elem.Id);
Transaction trans = new Transaction(doc);
trans.Start("ChangeColor");
doc.ActiveView.set_ProjColorOverrideByElement(ids, color);
trans.Commit();