.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
farrukhw
465 Views, 2 Replies

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

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.

2 REPLIES 2
Message 2 of 3

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
Message 3 of 3

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost