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"); } }
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(); }