Exemplo n.º 1
0
 public void testPalette()
 {
     Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     try
     {
         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.Style = PaletteSetStyles.ShowTabForSingle;
             //ps.Style = 16; //PaletteSetStyles.NameEditable;
             //ps.Style = 4; //PaletteSetStyles.ShowPropertiesMenu;
             //ps.Style = 2; //PaletteSetStyles.ShowAutoHideButton;
             //ps.Style = 8; //PaletteSetStyles.ShowCloseButton
             ps.Opacity = 90;
             ps.MinimumSize = new System.Drawing.Size(300, 300);
             System.Windows.Forms.UserControl myCtrl = new ModelessForm();
             //ctrl.Dock = System.Windows.Forms.DockStyle.Fill;
             ps.Add("test", myCtrl);
             ps.Visible = true;
         }
     }
     catch
     {
         ed.WriteMessage("Error Showing Palette");
     }
 }
        public void testPalette()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                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.Style = PaletteSetStyles.ShowTabForSingle;
                    //ps.Style = 16; //PaletteSetStyles.NameEditable;
                    //ps.Style = 4; //PaletteSetStyles.ShowPropertiesMenu;
                    //ps.Style = 2; //PaletteSetStyles.ShowAutoHideButton;
                    //ps.Style = 8; //PaletteSetStyles.ShowCloseButton
                    ps.Opacity     = 90;
                    ps.MinimumSize = new System.Drawing.Size(300, 300);
                    System.Windows.Forms.UserControl myCtrl = new ModelessForm();
                    //ctrl.Dock = System.Windows.Forms.DockStyle.Fill;
                    ps.Add("test", myCtrl);
                    ps.Visible = true;
                }
            }
            catch
            {
                ed.WriteMessage("Error Showing Palette");
            }
        }
        override public void OnDrop(System.Windows.Forms.DragEventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                Point3d pt = ed.PointToWorld(new Point(e.X, e.Y));

                using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())
                {
                    ModelessForm ctrl = (ModelessForm)e.Data.GetData(typeof(ModelessForm));
                    AsdkClass1.CreateDivision(ctrl.tb_Division.Text, AsdkClass1.sDivisionManager);
                    AsdkClass1.CreateEmployee(ctrl.tb_Name.Text, ctrl.tb_Division.Text, Convert.ToDouble(ctrl.tb_Salary.Text), pt);
                }
            }
            catch
            {
                ed.WriteMessage("Error handling OnDrop");
            }
        }
Exemplo n.º 4
0
        override public void OnDrop(System.Windows.Forms.DragEventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            //Get employee's coordinates in the drawing
            PromptPointOptions prPos = new PromptPointOptions("Enter Employee Position");

            prPos.AllowNone = false;

            PromptPointResult prPosRes = ed.GetPoint(prPos);

            if (prPosRes.Status != PromptStatus.OK)
            {
                return;
            }

            DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
            ModelessForm ctrl    = (ModelessForm)e.Data.GetData(typeof(ModelessForm));

            AsdkClass1.CreateDivision(ctrl.tb_Division.Text, AsdkClass1.sDivisionManager);
            AsdkClass1.CreateEmployee(ctrl.tb_Name.Text, ctrl.tb_Division.Text, Convert.ToDouble(ctrl.tb_Salary.Text), prPosRes.Value);

            docLock.Dispose();
        }