This example sets a color current through the Database object with the Cecolor property.
Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Colors <CommandMethod("SetColorCurrent")> _ Public Sub SetColorCurrent() '' Get the current document Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument '' Set the current color acDoc.Database.Cecolor = Color.FromColorIndex(ColorMethod.ByLayer, 256) End Sub
using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Colors; [CommandMethod("SetColorCurrent")] public static void SetColorCurrent() { // Get the current document Document acDoc = Application.DocumentManager.MdiActiveDocument; // Set the current color acDoc.Database.Cecolor = Color.FromColorIndex(ColorMethod.ByLayer, 256); }