I’ve received a query from a ADN partner on how to set default dock location for Paletteset for the first time when palette is activated and user should be able to dock Paletteset in all directions : Bottom,Left,Top,Right later on.
Here is the simple code to illustrate the same.
public static PaletteSet ps = null; [CommandMethod("MyPalette")] public void MyPalette() { if (ps == null) { ps = new PaletteSet("My Palette 1", new Guid("229E43DB-E76F-48F9-849A-CC8D726DF257")); ps.SetLocation(new System.Drawing.Point(312, 763)); ps.SetSize(new System.Drawing.Size(909, 40)); /*For the first time we 'll enable on Bottom*/ ps.DockEnabled = DockSides.Bottom; } ps.Visible = true; /*Add Handler*/ ps.PaletteSetMoved += ps_PaletteSetMoved; } void ps_PaletteSetMoved(object sender, PaletteSetMoveEventArgs e) { PaletteSet pt = sender as PaletteSet; /*Remove Handler*/ pt.PaletteSetMoved -= ps_PaletteSetMoved; pt.DockEnabled = DockSides.Bottom | DockSides.Left | DockSides.Top | DockSides.Right; } Sample Video :

Leave a Reply