public class Commands
{
private static PaletteSet _ps = null;
private static MyGrid _mg = null;
private bool Initialized = false;
public void InitPalette()
{
try
{
if (_ps == null)
{
_ps
= new PaletteSet
("AXYZPalette",
new Guid
("45fb0c44-3ede-48c2-838e-98d742d1b4a9")); _ps.DockEnabled = DockSides.None | DockSides.Left | DockSides.Right;
_ps
.Size = new System.Drawing.Size(600,
500); }
_ps.Visible = true;
if (_mg == null)
{
ElementHost host
= new ElementHost
(); host.AutoSize = true;
host.Dock = DockStyle.Fill;
host.Child = _mg;
_ps.Add("TreeView", host);
}
}
catch (System.Exception ex)
{
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(String.Format("Error: {0}", ex));
}
}
[CommandMethod("AXYZPalette", CommandFlags.Modal)]
public void DisplayPalette()
{
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(String.Format("_ps==null: {0}, Initialized: {1}", _ps==null , this.Initialized));
this.InitPalette();
this.Initialized = true;
}
}