Author Topic: AU 2005 code - Part 3 "Creating Custom Palettes"  (Read 2459 times)

0 Members and 1 Guest are viewing this topic.

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
AU 2005 code - Part 3 "Creating Custom Palettes"
« on: December 28, 2005, 02:31:03 PM »
This example requires a user control.  As written it actually requires two.  I actually reused the control from the Options Dialog example and created a new one.  However, multiple tabs can host different instances of the same user control.

Code: [Select]
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;

namespace AU2005.AcadApi
{

//Pages 8 & 9
public class ToolPalettesExample
{
private static PaletteSet au2005PaletteSet;

[CommandMethod("ShowPalette")]
public static void CreatePaletteSet()
{
if (au2005PaletteSet == null)
{
//Create a new palette set at a size of 300x500
au2005PaletteSet = new PaletteSet ("AU 2005 Palette Set Demo");
au2005PaletteSet.MinimumSize = new System.Drawing.Size(300,500);

//Add two palettes to the palette set
//The handout only shows adding a single tab
au2005PaletteSet.Add("Demo Palette", new AU2005.AcadApi.Au2005UserControl());
au2005PaletteSet.Add("Demo Palette 2", new AU2005.AcadApi.Au2005UserControl2());
}
au2005PaletteSet.Visible = true;
}


public static PaletteSet CustomPaletteSet
{
get
{
return au2005PaletteSet;
}
}


[CommandMethod("DockLeft")]
public static void DockLeft()
{
if (CustomPaletteSet != null)
{
CustomPaletteSet.Dock = DockSides.Left;
}
}

[CommandMethod("Undock")]
public static void UnDock()
{
if (CustomPaletteSet != null)
{
CustomPaletteSet.Dock = DockSides.None;
}
}
}
}
Bobby C. Jones