.NET

.NET

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

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

205 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: 390
Registered: ‎04-30-2009
Message 2 of 3 (195 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 (153 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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.