Example #1
0
        static private void  SetOpacity()
        {
            Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;

            Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt;
            do
            {
                resInt = e.GetInteger("Enter opacity:");
                if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                {
                    break;
                }
                if (resInt.Value >= 0 && resInt.Value <= 100)
                {
                    break;
                }
                e.WriteMessage("Opacity must be between 0 and 100\n");
            }while (true);

            ps.Opacity = resInt.Value;
        }
Example #2
0
        public static void DoIt()
        {
            if (ps == null)
            {
                //use constructor with Guid so that we can save/load user data
                ps       = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6"));
                ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load);
                ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save);
                ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton;
                ps.MinimumSize = new System.Drawing.Size(300, 300);
                ps.Add("Test Palette 1", new TestControl());
            }
            bool b = ps.Visible;

            ps.Visible = true;
            Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;

            Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking");
            if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                switch (res.StringResult)
                {
                case "Opacity":
                    Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt;
                    do
                    {
                        resInt = e.GetInteger("Enter opacity:");
                        if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                        {
                            break;
                        }
                        if (resInt.Value >= 0 && resInt.Value <= 100)
                        {
                            break;
                        }
                        e.WriteMessage("Opacity must be between 0 and 100\n");
                    }while (true);
                    ps.Opacity = resInt.Value;
                    break;

                case "TitleBarLocation":
                    res = e.GetKeywords("Select titlebar location:", "Left", "Right");
                    if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                    {
                        switch (res.StringResult)
                        {
                        case "Left":
                            ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Left;
                            break;

                        case "Right":
                            ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Right;
                            break;
                        }
                    }
                    break;

                case "Docking":
                {
                    res = e.GetKeywords("Choose a docking option:", "None", "Left", "Right", "Top", "Bottom");
                    if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                    {
                        switch (res.StringResult)
                        {
                        case "None":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None;
                            break;

                        case "Left":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
                            break;

                        case "Right":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right;
                            break;

                        case "Top":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Top;
                            break;

                        case "Bottom":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Bottom;
                            break;
                        }
                    }
                    break;
                }
                }
            }
        }