-1

I am porting some AutoCAD VBA to VB.Net.

Several of the modules do a ThisDrawing.SendCommand("_color" & vbCR) to popup an AutoCAD color picker, then process the response by doing a ThisDrawing.GetVariable("CECOLOR") to get the selected color.

With .Net, the SendCommand does not execute until the program ends.

How can I get the AutoCAD color picker to execute inline in my code?

Steve Reed Sr
  • 2,011
  • 3
  • 18
  • 22

1 Answers1

2

There is a ColorDialog class to do that. Here is some C# code:

using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Windows;

var cd = new ColorDialog();    
if (cd.ShowDialog() != DialogResult.OK) return;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage("\nSelected color: " + cd.Color);
Maxence
  • 12,868
  • 5
  • 57
  • 69