How to create a palette?
I use this code to create a PaletteSet:
[code] public class MyPalette_Cmd
{
static PaletteSet _ps = null;
[CommandMethod("MyPalette_Show")]
public static void MyPalette_Cmd()
{
if (_ps == null)
{
// Create the palette set
_ps = new PaletteSet("MyPalette");
_ps.Size = new System.Drawing.Size(400, 600);
}
// Display our palette set
_ps.KeepFocus = true;
_ps.Visible = true;
}
}
[/code]
But the behavior of the palette is not correct.
0
Comments
-
[code]public class MyPalette_Cmd{static PaletteSet _ps = null;[CommandMethod("MyPalette_Show")]public static void MyPalette_Cmd(){if (_ps == null){// Create the palette set_ps = new PaletteSet("MyPalette");_ps.Size = new System.Drawing.Size(400, 600);}// Display our palette set_ps.KeepFocus = true;_ps.Visible = true;}}[/code]0
-
public class Class1{public static UserControl1 oP = null;public static Bricscad.Windows.PaletteSet oPs = null;[CommandMethod("MyPalette_Show")]public static void MyPalette(){if (oPs == null){oPs = new Bricscad.Windows.PaletteSet("MyPalette");oPs.Style = Bricscad.Windows.PaletteSetStyles.ShowPropertiesMenu | Bricscad.Windows.PaletteSetStyles.ShowAutoHideButton | Bricscad.Windows.PaletteSetStyles.ShowCloseButton | Bricscad.Windows.PaletteSetStyles.Snappable;oPs.MinimumSize = new System.Drawing.Size(50, 50);oPs.Visible = true;}else{oPs.Visible = true;}if (oPs.Count == 0){oP = new UserControl1();oPs.Add("MyPalette", oP);}oPs.Dock = Bricscad.Windows.DockSides.None;oPs.Size = new System.Drawing.Size(300, 300);}}[/code]0
This discussion has been closed.