この例では、Database オブジェクトの Cecolor プロパティを使用して色を現在の色に設定します。
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); }