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

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

Anonymous
Not applicable
886 Views
2 Replies
Message 1 of 3

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

Anonymous
Not applicable

Hi Experts 🙂


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 😞

 

Any help would be really appreciated.

 

Thanks a bunch.

0 Likes
Accepted solutions (1)
887 Views
2 Replies
Replies (2)
Message 2 of 3

augusto.goncalves
Alumni
Alumni
Accepted solution

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
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 3 of 3

Anonymous
Not applicable

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

0 Likes