.NET

Reply
Active Contributor
farrukhw
Posts: 26
Registered: ‎05-07-2009
Message 1 of 3 (200 Views)
Accepted Solution

How to capture Drop even on Acad Drawing area from Listbox?

200 Views, 2 Replies
05-23-2012 11:32 PM

Hi Experts :smileyhappy:


I'm just a new bie. I've made a simple list box with some text entries. I can drag from any node to Acad's Drawing area and drop it. And without writing any code to capture Drop event, same text is written there in Top Left corner of Drawing area.

I want to Catpure this Drop even of Acad Drawing area. I will then be able to use Jig classes to add my own entities.

 

I tried Application.DoDragDrop() method and invoke DragTarget.OnDrop() but confused very much :smileysad:

 

Any help would be really appreciated.

 

Thanks a bunch.

Hi,

 

When you start the drag, call

Application.DoDragDrop(sourceControl, dataObject, .....)

 

Then you need to create a class that implements DropTarget which the OnDrop method, this among others, get the data passed on the second parameter of DoDragDrop

e.Data.GetData(typeof(YouDataType))

 

Also convert the point to AutoCAD coordinates with

Editor ed = AppAutoCAD.DocumentManager.MdiActiveDocument.Editor;
int vport = (short)AppAutoCAD.GetSystemVariable("CVPORT");
Point3d insertPoint = ed.PointToWorld(new Point(e.X, e.Y), vport);

 

Hope this help.

 

Regards,

ADN Support Specialist
augusto.goncalves
Posts: 387
Registered: ‎04-30-2009
Message 2 of 3 (190 Views)

Re: How to capture Drop even on Acad Drawing area from Listbox?

05-24-2012 06:50 AM in reply to: farrukhw

Hi,

 

When you start the drag, call

Application.DoDragDrop(sourceControl, dataObject, .....)

 

Then you need to create a class that implements DropTarget which the OnDrop method, this among others, get the data passed on the second parameter of DoDragDrop

e.Data.GetData(typeof(YouDataType))

 

Also convert the point to AutoCAD coordinates with

Editor ed = AppAutoCAD.DocumentManager.MdiActiveDocument.Editor;
int vport = (short)AppAutoCAD.GetSystemVariable("CVPORT");
Point3d insertPoint = ed.PointToWorld(new Point(e.X, e.Y), vport);

 

Hope this help.

 

Regards,

Regards,



Augusto Goncalves
Autodesk Developer Network
Active Contributor
farrukhw
Posts: 26
Registered: ‎05-07-2009
Message 3 of 3 (148 Views)

Re: How to capture Drop even on Acad Drawing area from Listbox?

06-29-2012 06:43 AM in reply to: augusto.goncalves

Thanks a bunch for your reply. I did something similar while experimenting with some sample code.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!